0

Excluding files and directories from a tar backup

I’m making a backup of a clients site right now and noticed that they have a directory of mp3′s that’s huge. I don’t need this directory in the backup. In the tar manual I see that the switch —exclude allows me to exclude some files from my backup.

tar zcvf google-website.tgz —exclude “htdocs/mp3s/*” htdocs

This example assumes that I’m in the directory one level up from the one I want to tar up. Specifying full paths to the archive, the exclusion and the htdocs directory would work too.

Share and Enjoy:
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Slashdot
  • StumbleUpon
  • Technorati