On Tue, May 31, 2011 at 8:39 AM, Stuart Henderson <[email protected]> wrote: > On 2011-05-31, Marian Hettwer <[email protected]> wrote: >> On Tue, 31 May 2011 10:53:58 +0200, LEVAI Daniel <[email protected]> >> wrote: >>> On Tue, May 31, 2011 at 11:42:24 +0300, Michael Sioutis wrote: >>>> Hello! >>>> >>>> I can't find it in the man page, and it seems it is not supported (?) >>>> I am trying to backup some folders and want to exclude some and nth >>>> will work. I've tried: >>>> --exclude=/folder/ >>>> --exclude="/folder/ >>>> --exclude /folder >>>> --exclude "folder" >>>> >>>> I will get an error: "--exclude... directory doesn't exist". >>>> >>>> Excluding will work in Linux. >>>> >>> That is a GNU extension. You can work this around with find(1) and the >>> tar(1)'s '-I' option. >>> >>> >> >> bsdtar from the FreeBSD project supports --exclude too. >> The OP could as well install gnu tar from packages. bsdtar doens't seem >> to exist... >> >> At least that's what I do at work (Debian, Solaris, OpenBSD env). >> It's a pain to walk around every nifty details of different unixes... > > The other way you can do it is just use posix-specified options and > not rely on vendor-specific extensions. But unfortunately many of the > vendors (*cough*gnu*cough*) don't make it clear which options are > standard and which are extensions... And, sadly, even some of the > BSD-derived OS have replaced a bunch of their standard tools with GNU.
GNU tools have become the industry standard, for a stack of reasons. This sort of useful feature for "tar", its protective autostripping of leading slashes, and its built-in compression access are only a few of the reasons its become so popular. Transforming a simple "--exclude" based command line into a set of "included" targets can become extremely awkward, especially when snapshotting a dynamic target (for backup purposes) or dealing with file names from a shared file system (such as an NFS or Samba published system in international settings) that parsing the names can cause..... chaos. I've had similar issues with the "cp" command, and its lack of "cp -a". I've taken to using "rsync", first, to generate a target space that I can then run the "tar" or other commands against. With cheaper, faster disk these days, it's usually cheaper for me as a programmer to do this.

