On 02/18/2011 06:20 PM, Luca Daniel wrote: > Hi there :-) > I have o problem and an suggestion : > 1) The problem: I can't find an easy way to remove a type of file through > all sub-directories with GNU tool "rm" (remove). There is not an option to > search through all sub-folders , only in the current working directory. Back > when I used windows this was easy with the command : del /s *.pdf .
# Portable: find . -name '*.pdf' -exec rm {} + # Faster, if you use GNU findutils: find -name '*.pdf' -delete # Or, if you use bash: # one-time setup - add this in your ~/.bashrc shopt -s globstar # then use ** for your goal rm *.pdf **/*.pdf > 2) The suggestion : please make an option for the "rm" command to look in > sub-directories so it can be easier to use and increase functionality . Sorry, but this would add bloat to rm, when the find utility already exists for this purpose. And even if we added it to GNU rm, it wouldn't help you on any other Unix-like system where such a new option is not present. The philosophy of doing one thing well, and using the right tool for the job, is rather important. > I asked some people about this problem I have and the answer I got was not > pretty in the sense that it was not a pretty command =) . I can't remember > what is was because it was complicated (mixed with locate or find) find may look daunting, but learning it will pay big dividends, as it is then a very powerful tool in your toolbox. -- Eric Blake ebl...@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature