Tuesday, June 29, 2010

 

Archiving recently modified files

If you have recently added to your mp3 or jpg library and want to backup just new additions, here is the command to create a tar archive of files modified in the last 2 days.
find . -mtime -2 -print | sed -r "s/([^a-zA-Z0-9])/\\\\\1/g" | xargs tar -rvf new.tar
The find command finds the files, the sed command escapes non-ascii characters, the xarg command fires up tar commands which append to the tar archive called 'new.tar'. The find option '-mtime -2' means files that have been modified in the last day days.
Comments: Post a Comment



<< Home
Newer Posts Older Posts