find -delete

If I hear one more person recommend using a pipe to xargs or -exec rm -f {}  to the question “how can I make ‘find’ delete the files it finds?” I’m going to scream. It’s really simple:

find /wherever -mtime +7 -type f -delete

That’s it. Nothing to remember. No shelling (exec) or piping. Real easy. Real fast.

This entry was posted in Coding, Rants/Tirades, Work and tagged , . Bookmark the permalink.

Leave a Reply

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