问题
I run this command to compress the content of current folder while excluding some directories:
mahmood@mpc:set3-HHLL$ l
file1.txt a/ c/
file2.inp b/ ...
mahmood@mpc:set3-HHLL$ tar cvjf ../set3.tar.bz2 * --exclude=a/ --exclude=b/ --exclude=c/
However in the output I see:
file1.txt
file2.inp
a/1.out
a/2.out
2/1.out
...
Why it ignores the command line options?
回答1:
The correct command would be:
tar cvjf ../set3.tar.bz2 * --exclude='a' --exclude='b' --exclude='c'
来源:https://stackoverflow.com/questions/8020690/excluding-some-folders-in-tar-command-not-work