Thursday, December 10, 2009

Delete Files Older Than x Days on Linux

Delete Files Older Than x Days on Linux



find /path/to/files* -mtime +5 -exec rm {} \;



find . -name "*.trc" -mtime +30 -exec rm {} \;

find . -name "*.trw" -mtime +30 -exec rm {} \;





Just be aware that this will also remove any old files that exist in subdirectories of $FTPDIR as well, not just $FTPDIR itself, which may be an undesirable effect.

No comments: