Excluding files and folders with tar

by cliper Wednesday, December 08, 2010 9:24 AM

Excluding files/folders using tar is very straight forward.

Assuming we have a directory tree similar to this in Linux

-/home/cliper/
            |--- folder/
                     |--- file1
                     |--- file2
                     |--- folder

and we want to exclude file2 and folder to the archive, then command would be like:

tar –czpf filename.tgz --exclude=/home/cliper/folder/file2 --exclude=/home/cliper/folder/folder

Add comment


(Will show your Gravatar icon)

  Country flag

biuquote
  • Comment
  • Preview
Loading



About the author

Author's PhotoI enjoy web developing and would like to share my thoughts of it.

Send mailE-mail me

Most comments

Calendar

<<  February 2012  >>
MoTuWeThFrSaSu
303112345
6789101112
13141516171819
20212223242526
2728291234
567891011

View posts in large calendar