*nix: Delete a lot of files at once

Make sure you understand what this command does. Do not just copy and paste.

Delete files WITHIN 7 days. Example. files extracted a few minutes ago and you no longer need them. Ideally, replace the "." with full path.

find . -name "*" -mtime -7 -exec rm {} \;



#more than 7 days. This is for files you want to keep in last 7 days and do not want to keep anything that are longer than 7 days.


find . -name "*" -mtime +7 -exec rm {} \;

No comments:

Post a Comment