Peter Otten <__pete...@web.de> writes: > Carl Banks wrote: > >> 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.) > > What's the advantage of 'find ... | xargs ...' over 'find ... -exec ...'?
Exec launches a new instance of 'rm' for each found file, while xargs launches a single instance, and passes the list of found files as arg- uments. Probably not a big deal in this case, but if you're passing a long list of files to a script that has a long startup time, it can make a big difference. sherm-- -- Sherm Pendley <http://camelbones.sourceforge.net> Cocoa Developer -- http://mail.python.org/mailman/listinfo/python-list