Thursday | 04 DEC 2025

next

2025-09-26
Find Cheatsheet

sysadmin, cheatsheets

Delete files by mtime:

find . -type f -mtime +5  -delete

The above command will delete files that are older than 5 days.

Move files by mtime:

find . -type f -mtime +380  -exec mv {} /path/to/dir/ \;

This will find the files that have a mtile older than 380 days and then it will move them to a new location. the ; is the way to end the command so that you can add more flags after the exec.