With great power comes the easy possibility of deleting all your files
Normally, when I want to use the find
command to delete files, I do this:
Turns out I could also do this:
However, while investigating the -delete
action, I read this in man find
:
Well, sure, that really does make sense. Putting the -delete
action where the expressions go would definitely cause a disaster. At the same time, you’d like to think that you might get warned first before find
went ahead and nuked all your files. Two takeaways from this:
-
UNIX doesn’t baby its users. If you tell your system to delete your files, by God, that’s what it’s going to do!
-
Always test your particular
find
construction first before unleashing its full fury.