Powered By Blogger

Monday, August 20, 2012

Excluding directories and files in tar command

Create a file with all the dictories and files  that you want to exclude in the tar

# less exclude
 test1

 hello

Execute following command

# tar -cvfX test.tar ./exclude *
a hello excluded

a test/ 0K
a test1 excluded
a test2/ 0K
a test3/ 0K


Extract with tar as usual

# tar -xvf test.tar

 
Welcome to the UNIX world