Friday, July 15, 2016

Linux: How to tar only selected folders and files

Step 1: Select the files and prepare a list.

I do this with a simple function in my .bashrc script:

$> cat >> ~/.bashrc
99 function cscopesetup()
100 {
101     rm cscope.files;
102
103     echo "Populating filenames...";
104     find $SRC/folder1/ -iname "*.c" -print >> cscope.files #folder1
105     find $SRC/folder9/ -iname "*.h" -print >> cscope.files #folder9
106     echo "Driver done"
107 }

ctrl-D

Run this from the bash command:
$> source ~/.bashrc

This will create a file on your home directory with the name cscope.files

If you open this file, you should see the names of all the files you want to tar and backup.

Step 2: Now tar the files
$> tar -cvf myfile.tar -T cscope.files

This will do it.

3 comments:

Anonymous said...

Very useful for selective backup of files! Thanks.

Mailey Sirus 2 said...

24's Aljamain Sterling: I let fans, media coordinate style in 2 Profoundly Cited-MMAjunkie.com-19 hours earlier. Dana White: McGregor versus Mayweather is 'one and done,' no more. All the talk about UFC lightweight champion Conor McGregor going up against multi-time champion Floyd Mayweather has stirred up a couple of other.
UFC 210
UFC 210 Live , UFC 210 Fight Card , UFC 210 Fight , UFC 210 Card , UFC 210 Live Stream , UFC 210 PPV



"Disorder" Miller admits to around dozen. The past UFC middleweight yielded to just about twelve legal offenses and wrongdoings beginning from various clashes with police over. UFC on FOX 24: Aljamain Sterling let fans and media play into his. Sterling will want to end his slide when he goes up against Augusto Mendes at UFC on FOX 24 on April 15 in Kansas City, Mo. Additionally, you can trust.
UFC 210
UFC 210 Live , UFC 210 Fight Card , UFC 210 Fight , UFC 210 Card , UFC 210 Live Stream , UFC 210 PPV

SRUN POR said...

Thanks for this blog.
gclub casino
goldenslot
Gclub จีคลับ

Post a Comment