TAR Examples

2013-09-24

Just for easy reference...

tar --exclude='*.jpg' --exclude='*.png' --exclude='*.mp3' --exclude='*.mov' --exclude='*.wmv' --exclude='*.avi' --exclude='*.mp4' --exclude='*.pdf' -czf site.com.20130924.tgz /var/httpd/site.com
#!/bin/bash d=$(date +'%Y%m%d') # can't update compressed archive, so just .tar (gzip archive after if needed) file="all_pdfs.${d}.tar" echo "Tar..." # don't pipe to xargs (use -exec and u (update) flag)... xargs _silently_ fails on large lists... find /var/www/html -iname '*.pdf' -exec tar uvf $file {} + echo "Done: $file"