bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#8079: rm command problem/suggestion


From: Alan Curry
Subject: 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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]