GNU bug report logs - #8079
rm command problem/suggestion

Previous Next

Package: coreutils;

Reported by: Luca Daniel <lucadaniel84 <at> gmail.com>

Date: Sat, 19 Feb 2011 01:36:02 UTC

Severity: normal

Done: Jim Meyering <jim <at> meyering.net>

Bug is archived. No further changes may be made.

Full log


Message #8 received at 8079 <at> debbugs.gnu.org (full text, mbox):

From: Eric Blake <eblake <at> redhat.com>
To: Luca Daniel <lucadaniel84 <at> gmail.com>
Cc: 8079 <at> debbugs.gnu.org
Subject: Re: bug#8079: rm command problem/suggestion
Date: Fri, 18 Feb 2011 20:08:41 -0700
[Message part 1 (text/plain, inline)]
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   eblake <at> redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

[signature.asc (application/pgp-signature, attachment)]

This bug report was last modified 14 years and 157 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.