Nov 1, 2010

Exclude folder using TAR command during backup process

Subject: Tar command
 
In tar command one can exclude the so called not so required folder & sub-folders during backup by:

[root@lino ~] # tar -cvf backup.tar projects/ --exclude="<folder path to be excluded>"

For excluding multiple folders:

[root@lino ~] # tar -cvf backup.tar projects/ --exclude="<folder-1 path to be excluded>" --exclude="<folder-2 path to be excluded>"

-c    creates a new archive  file
-v    verbosely lists files processed
-f    use archive file or device F (default "-", meaning stdin/stdout)
--exclude    will exclude the folders and files