Nimal blogs here
10 Aug 2009
I’m always confused with the use of ‘exclude’ options with ‘tar’. Here I’m sharing a few tips I found online, just in case it might help you. The meanings of –exclude and –exclude-from are always confusing:
When using –exclude=pattern, be sure to quote the pattern parameter, so GNU tar sees wildcard characters like ‘*’.
For example, write:
$ tar -c -f <em>archive.tar</em> --exclude '*.o' <em>directory</em>
tar does not act on a path name explicitly listed on the command line if one of its file name components is excluded. If files that end with ‘*.o’ are excluded when creating an archive, but explicitly name the file ‘dir.o/foo’ after all the options have been listed, ‘dir.o/foo’ will be excluded from the archive.
Only shell syntax, or globbing will work with exclude options in tar. The command might fail if regexp syntax is used to describe files to be excluded in the command.
Reference:
I'd love to here from you, be the first one to comment...
Leave a reply