Skip to content

Instantly share code, notes, and snippets.

@rponte
Last active March 1, 2021 06:53
Show Gist options
  • Save rponte/cc63523f66483c9300a4 to your computer and use it in GitHub Desktop.
Save rponte/cc63523f66483c9300a4 to your computer and use it in GitHub Desktop.
Shell script to remove (delete) old files
# removes files older than 10 days under specific dir
find /my/dir -mtime +10 -type f -delete
# another example: deleting files older than 2 days under current dir
find . -mtime +2 -type f -delete
# deleting files older than 5h (5*60min=250min) under current dir
find . -mmin +250 -type f -delete
@rponte
Copy link
Author

rponte commented Nov 14, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment