Michael Svanström

developer, photographer

Moving old files in Linux

Archiving might become a necessity when storing a lot of files on a server. This is a snippet which moves files older than a year to another directory. Note the -print0 and -0 (zero) which add null characters for escaping spaces and backslashes. find myfiles/ -mtime +365 -print0 |xargs -0 -I {} mv {} myfiles_old/