exclude nested folder from tar
I am obviosuly missing something in this simple command, but have spent quite a while trying different combinations. Please advise if you can find the error I am missing.
Code:
tar cvzf squidanalyzer-6.0.tgz --exclude=./squidanalyzer-6.0/etc/log/* squidanalyzer-6.0/ squidanalyzer-6.0/etc/ squidanalyzer-6.0/etc/excluded squidanalyzer-6.0/etc/included squidanalyzer-6.0/etc/squidanalyzer.conf squidanalyzer-6.0/etc/network-aliases squidanalyzer-6.0/etc/log/ squidanalyzer-6.0/etc/log/access_log squidanalyzer-6.0/etc/log/access_log-20140914 squidanalyzer-6.0/etc/log/error_log-20140921 squidanalyzer-6.0/etc/log/error_log-20140914 squidanalyzer-6.0/etc/log/error_log-20140928 squidanalyzer-6.0/etc/log/access_log-20140907 squidanalyzer-6.0/etc/log/access_log-20140923 squidanalyzer-6.0/etc/log/error_log-20141005 squidanalyzer-6.0/etc/log/error_log squidanalyzer-6.0/etc/user-aliases squidanalyzer-6.0/Makefile squidanalyzer-6.0/ChangeLog I tried other permutations of the exclude pattern as Code:
tar -cvzf squidanalyzer-6.0.tgz --exclude='./squidanalyzer-6.0/etc/log/*' squidanalyzer-6.0 Any guidance/suggestion is greatly appreciated. Thanks ! |
Can you tell us what directory you're in when you run this command.
jdk |
The parent directory of squidanalyzer-6.0
I ran my tar command at /home/threezerous/ level So my directory structure looks like /home/threezerous/squidanalyzer-6.0 /home/threezerous/squidanalyzer-6.0/etc/ /home/threezerous/squidanalyzer-6.0/etc/excluded /home/threezerous/squidanalyzer-6.0/etc/included ... ... /home/threezerous/squidanalyzer-6.0/etc/log/access_log /home/threezerous/squidanalyzer-6.0/etc/log/access_log-20140914 /home/threezerous/squidanalyzer-6.0/etc/log/error_log-20140921 ... ... |
You might try dropping the "./" from the exclude line.
Exclusions are done based on string matching... Since the list doesn't inlude the "./" (it is based on "squidanalyzer-6.0/") it won't recognize the equivalence. |
Apologies for the late response. But yes, that solved the issue. Thanks very much
|
All times are GMT -5. The time now is 08:24 AM. |