Posts Tagged ‘delete files’

Linux – delete files which modified time older than 7 days

find /filePath/* -mtime +7 -delete

or

find /filePath/* -mtime +7 -exec rm {} \;

Where “-mtime” parameter will look for file modified time older than “+7″ days. You may want to change “+7″ to longer days, for example “+30″ days, “+90″ days

“-exec” parameter allows you to call another command. The “{} \;” is required at the end.

  • Share/Save/Bookmark