rm -rf will fail if something tries to delete the same file tree (I think because rm enumerates the files first, then deletes).
A simple test:
# Terminal 1
for i in `seq 1 1000`; do mkdir -p /tmp/dirtest/$i; done
# Now at teh same time in terminal 1 and 2
rm -rf /tmp/dirtest
There will be some output into stderr, e.g.:
...
rm: cannot remove directory `/tmp/dirtest/294': No such file or directory
rm: cannot remove directory `/tmp/dirtest/297': No such file or directory
rm: cannot remove directory `/tmp/dirtest/304': No such file or directory
I can ignore all the stderr output by redirecting it to /dev/null, but removing of /tmp/dirtest actually fails! After both commands are finished, /tmp/dirtest is still there.
How can I make rm delete the directory tree properly and really ignore all the errors?
find /tmp/dirtest -deletewould – xenoterracide♦ Mar 4 '11 at 2:28rm-ing with two terminals is just an easy-to-reproduce artificial scenario. – Alex B Mar 4 '11 at 2:47