I'm trying to zip the contents of a site using tar and exclude a bunch of folders and error_log files but it doesn't seem to be working, when it's processing I still see many of the excluded files being processed.

I am in the root of the site and I am trying to tar everything inside of public_html.

Here is the command I am running:

tar -zcvf files-live.tgz public_html/ --exclude='public_html/cache' --exclude='public_html/uplimg' --exclude='public_html/images/listings' exclude='public_html/sets' exclude='public_html/manage' exclude='error_log'

Side Note: error_log exists in several directories but I don't want any of them included.

What am I doing wrong here?

closed as off-topic by Jakuje, Archemar, jimmij, garethTheRed, Scott Apr 2 '16 at 11:33

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions describing a problem that can't be reproduced and seemingly went away on its own (or went away when a typo was fixed) are off-topic as they are unlikely to help future readers." – Jakuje, Archemar, jimmij, garethTheRed, Scott
If this question can be reworded to fit the rules in the help center, please edit the question.


You used exclude= instead of --exclude=.

 tar -zcvf files-live.tgz public_html/ --exclude='public_html/cache' --exclude='public_html/uplimg' --exclude='public_html/images/listings' --exclude='public_html/sets' --exclude='public_html/manage' --exclude='error_log'
  • Ahh crap, stupid error by me. What do you mean I don't need to exclude error_log? This file exists in several sub-directories of public_html as well as inside public_html. – Brett Apr 2 '16 at 8:35
  • @Brett I thought error_log was a directory in the same folder as public_html. I didn't know that people would make error_log accessible by http. – v7d8dpo4 Apr 2 '16 at 8:40
  • No, error_log are files created by the server which end up in a whole range of directories. – Brett Apr 2 '16 at 8:43

Not the answer you're looking for? Browse other questions tagged or ask your own question.