Written by James McDonald

May 1, 2024

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.

You May Also Like…

Robocopy exclude Directories

Just trying to copy everything except a couple of directories from a drive to my NAS This is the secret incantation of...