rm runs without problems. The problem is that find confused, because he knew that the ./a directory ./a , he is trying to visit that directory to look for directories named a . However, find cannot enter the directory because it has already been deleted.
One way to avoid this is to do
find -name a -type d | xargs rm -r
This will allow the search to move forward before executing the rm command. Or you can simply ignore the error in the original command.
source share