why does find / rm tells me it doesn't find a folder after it found it?
You can see why this happens if you imagine that find
works this way:
-
make a list of all folders in the current directory
-
for each one named "bin", run the given command
-
descend into each folder and start from step 1
In your case, the given command is to remove the folder. Thus when you reach step 3 and try to descend into the folder, it is already gone - giving you the "No such file or directory" warning.
In reality find
works in a bit more complicated way, but the above is detailed enough to understand what happens here.
All in all the command will work like you want it to, but you'll get these extra warnings. You can make them go away by adding a -maxdepth 2
option to the command if you know that your directory structure always has the bin folder at that level, or you can use the -prune
action to not ensure that the search does not descend into the bin
folders.