haim evgi Asked: 2010-01-07 06:29:17 +0800 CST2010-01-07 06:29:17 +0800 CST 2010-01-07 06:29:17 +0800 CST exclude directory with tar command 772 T would like to use the tar command in Linux to back up some files, but i would like to exclude a specific directory from the archive. How can I do that? linux tar exclude 2 Answers Voted Best Answer BuildTheRobots 2010-01-07T06:31:54+08:002010-01-07T06:31:54+08:00 so, lets back up the directory /directory and everything in it, but ignoring any files called IGNORE-ME. tar -cf backup.tar /directory --exclude "IGNORE-ME" If it wasn't snowing out, i'd probably point out that man tar is as good as RTFM (and google 'tar exclude file' is even faster). Kyle Brandt 2010-01-07T06:33:08+08:002010-01-07T06:33:08+08:00 You can also put all of the patterns in a file and use: -X, --exclude-from=FILE exclude files matching patterns listed in FILE
so, lets back up the directory /directory and everything in it, but ignoring any files called IGNORE-ME.
tar -cf backup.tar /directory --exclude "IGNORE-ME"
If it wasn't snowing out, i'd probably point out that
man tar
is as good as RTFM (and google 'tar exclude file' is even faster).You can also put all of the patterns in a file and use: