* Sandro Tosi <[email protected]>, 2014-02-28, 19:49:
| find . -name __pycache__ -exec rm -rf {} \;
| find: `./dot/pygraph/__pycache__': No such file or directory
[...]

this is really weird! it seems that find is able to find the directories

Here's a minimal way to reproduce the problem:

$ mkdir __pycache__
$ find . -name __pycache__ -exec rm -rf {} \;
find: ‘./__pycache__’: No such file or directory

The trouble is that is that find tries to descend to the directory that has just been deleted, which of course doesn't work. Appending -prune to the find command-line fixes the problem:

$ mkdir __pycache__
$ find . -name __pycache__ -exec rm -rf {} \; -prune
$ echo $?
0

--
Jakub Wilk

_______________________________________________
Python-modules-team mailing list
[email protected]
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/python-modules-team

Reply via email to