On Jan 17, 6:29 pm, Alice Bevan–McGregor <[email protected]> wrote:
> find . -name \*.pyc -exec rm -f {} \;
>
> vs.
>
> rm -rf __pycache__
>
> I do not see how this is more difficult, but I may be missing something.
Well the former deletes all the pyc files in the directory tree
whereas the latter only deletes the top level __pycache__, not the
__pycache__ for subpackages. To delete all the __pycache__s you'd
have to do something like this:
file . -name __pycache__ -prune -exec rm -rf {} \;
or, better,
file . -name __pycache__ -prune | xargs rm -rf
Still not anything really difficult. (I don't think a lot of people
know about -prune; it tells find don't recursively descend.)
Carl Banks
--
http://mail.python.org/mailman/listinfo/python-list