0

Looking at the man-page for tar it's stated that --exclude=PATTERN will " exclude files, given as a PATTERN ". I'm not sure if PATTERN is explained in more detail somewhere else, but why does the user have to supply a separate --exclude option for every directory or file? For example,

tar cvzf backup.tar.gz / --exclude=/home,/sys,/proc

as opposed to

tar cvzf backup.tar.gz / --exclude=/home --exclude=/proc --exclude=/sys

1 Answer 1

3

Refer to 6.4 Excluding Some Files in the manual. In addition to accepting multiple --exclude options, GNU tar has this option, for multiple patterns:

-X, --exclude-from FILE
exclude patterns listed in FILE

In the manual, it explains that patterns are shell wildcards.

As for why it does it this way: longstanding convention uses a single value from a command-line option which takes a value. If each program invented different ways of parsing command-lines, it would be more work to maintain.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .