equals to:
one neat function of the find command, it that what it found can be passed to another program for further processing.
or: it can delete the file by adding the option -delete
BUT (!!!) THIS IS DANGEROUS! as things can go horribly wrong (and it does not ask for confirmation), in the worst case: deleting EVERYTHING in the current directory within the blink of an eye (depending on systems speed… terrabytes of data within seconds).
# warning! this can ruin one's day mkdir temp cd temp touch 1 2 3 f25020672.avi # only finds that file find . -name "*f25020672.avi*" ./f25020672.avi
# DANGER! THIS DELETES ALL (!!!) FILES! (like rm -rf /)
# NEVER EVER DO THIS: find . -delete -name "*f25020672.avi*" # what the user actually wantd/correct way to do it: find . -name "*f25020672.avi*" -delete
guess will have to powerdown, and continue when the backup-system of the backup-system is ready X-D
why? (actually)
because find does argument “left to right” processing and regards -delete as an action (-name stands for action “just print the damn filenames”)
as soon as it finds an “action” argument, it will spring into “action” and delete ALL your files no matter what argument comes after the action argument (a -name argument for example).
asked the users @ https://www.gnu.org/software/findutils/
the answer was: will improve the manpage “great”
comment: but the UNIX philosophy is to simplify, simplify, simplify,and pretty much follow that principle and it works wonders 🙂
what about simplifying the usability & build in fail safes?
so everyone here says it is intended behavior that find -delete -name “*searchforthis*” just deletes everything under the current dir .
ok, guess there will have to be a find2 then
this intended behaviour by find forces users to transition from ext4 to zfs or btrfs and will still cost 3 years of sorting 1 million photorec restored jpg (without the filenames) by hand (until an AI comes up and does the job)
so cu in 2025
undelete?
on ext3, this is no problem, on ext4… photorec can restore photos, but not filenames… so probably a major problem…
liked this article?
- only together we can create a truly free world
- plz support dwaves to keep it up & running!
- (yes the info on the internet is (mostly) free but beer is still not free (still have to work on that))
- really really hate advertisement
- contribute: whenever a solution was found, blog about it for others to find!
- talk about, recommend & link to this blog and articles
- thanks to all who contribute!