[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

A simple question about wildcards with tar


I'm trying to make a backup with tar, but there are certain files that
I don't want to include in the backup.  Reading the info documentation
about tar, it says that I can use the --exclude=PATTERN option.  So if
I type

  tar -cvf backup.tar --exclude='*.fig' *

then it excludes all files that end with .fig.  However, if I also
want to exclude files that end with .fig.bak, then it
seems that

  tar -cvf backup.tar --exclude='*.fig*' *

should work.  But it doesn't.  Typing 

  tar -cvf backup.tar --exclude='*.fig*' --exclude='*.fig????' *

does work.  But it won't work for me in the general case, where I
won't know how many characters follow the pattern that I'm matching.
Does anyone know how to do this?

Walter Landry

Reply to: