Delete all files older than x days linux

This command deletes all files…

Login

Blog History

This command deletes all files modified more than 30 days ago in the current directory

# have a look at what it will delete
find ./ -type f -mtime +30 | more

# then get an idea of how many files it will delete
find ./ -type f -mtime +30 | wc

# after you are happy run with the -delete param
find ./ -type f -mtime +30 -delete

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

The reCAPTCHA verification period has expired. Please reload the page.