find to delete old files recursively | CSIM Technical Notes

Wed Apr 27 09:57:32 ICT 2016

Using find to delete old files recursively

find . -mtime +21d -depth -delete

To delete files and directories with a modification date older than 21 days.

-depth is needed to ensure a in-depth tree recursion, so the directories can be deleted only after they have been emptied.


Posted by Olivier | Permanent link | File under: administration, freebsd