Why does the command
tar -cvpzf backup_140128.tar.gz --exclude=/backup_140128.tar.gz --exclude=/temp_intel * not exclude the
If you're running this from
* will list directories without the leading slash. Try it yourself; do
for dir in *; do echo $dir; done.
This is exactly what
tar will see, and clearly
temp_intel doesn't match the
/temp_intel expression given to --exclude. Actually, I rather suspect backup_140128.tar.gz, if present, is also not being excluded.
So three options (I haven't tried any of them, this is theoretical):
- Force addition of the slash by using
/*in your tar command line.
--exclude=temp_intelso it matches (assuming you don't have any other
temp_inteldirectories you want excluded).
- Play with the
--anchoredoption to tar, the description wasn't very clear but I think it may remove the leading
/before doing the comparison.