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 #11 received at 8079 <at> debbugs.gnu.org (full text, mbox):

From: "Alan Curry" <pacman-cu <at> kosh.dhis.org>
To: lucadaniel84 <at> gmail.com (Luca Daniel)
Cc: 8079 <at> debbugs.gnu.org
Subject: Re: bug#8079: rm command problem/suggestion
Date: Fri, 18 Feb 2011 22:10:59 -0500 (GMT+5)
Luca Daniel writes:
> 
> 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   .

You misplace the blame on rm; the problem is that the standard unix shell
doesn't have recursive globbing. Doing it in the shell means that all
utilities benefit. rm is just one of them.

zsh does recursive globbing with a double-asterisk, so that for example

  rm **/*.pdf

would get rid of all files named *.pdf anywhere under the current directory.
bash also knows about the ** recursive glob, but I recommend zsh because it
has a lot more cool features, like

  **/*.(pdf|ps)(m+30Lk-500)

(recursive directory search, all files named *.pdf or *.ps, whose last
modification was more than 30 days ago, with a size less than 500k)

-- 
Alan Curry




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

Previous Next


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