Friday, December 02, 2011

exclude directories when using GNU tar

tar zvcf name.tar.gz --exclude path/to/dir1 --exclude path/to/dir2 path/to/tar

Note:

  1. Do not include a trailing '/' in the path of excluded directories.  Otherwise, it won't work.
  2. Put --exclude before the directory/file to be tarred.

No comments: