Posts or Comments 20 August 2008

OS X / Unix Matt | 26 May 2007 11:25 am

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: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • bodytext
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Slashdot
  • StumbleUpon
  • Technorati

Trackback This Post | Subscribe to the comments through RSS Feed

Leave a Reply