Thursday, April 9, 2015

Find files and tar them

/note to myself

Finding files with most powerful utility find sending them to tarball
  find . -maxdepth 2 -type f -print0 | tar -czvf backup.tar.gz --null -T -  

It will:
  • deal with files with spaces, newlines, leading dashes, and other funniness
  • handle an unlimited number of files
  • won't repeatedly overwrite your backup.tar.gz like using tar -c with xargs will do when you have a large number of files

No comments:

Post a Comment