Skip to content

Instantly share code, notes, and snippets.

@asiellb
Forked from rponte/remove-old-files.sh
Created March 1, 2021 06:53
Show Gist options
  • Save asiellb/c6067cff503d576d8c7267beaee5402a to your computer and use it in GitHub Desktop.
Save asiellb/c6067cff503d576d8c7267beaee5402a 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment