Re: find . -print0 -name 'foo' | xargs rm

2007-11-03 Thread Phil Pennock
On 2007-11-02 at 08:06 -0500, Peter da Silva wrote: > Especially when you have a PFY who loves zsh and uses it for scripting > after you've told him not to. Yeah, I said it's write-only. I support not using it for production scripting, but then this is an environment which disavows Perl and has

Re: find . -print0 -name 'foo' | xargs rm

2007-11-02 Thread Peter da Silva
On 02-Nov-2007, at 10:56, A. Pagaltzis wrote: File::Find::Rule -- not File::Find. This naming convention is made of hate and rotting wombat spleens.

Re: find . -print0 -name 'foo' | xargs rm

2007-11-02 Thread Peter da Silva
On 02-Nov-2007, at 09:55, sabrina downard wrote: (Not least because I am used to various sorts of brain-damage, like in iterating over strings with spaces in them in shell loops, and it confuses me to find that someone actually fixed the brain-damage rather than working around it like the rest of

Re: find . -print0 -name 'foo' | xargs rm

2007-11-02 Thread demerphq
On Nov 2, 2007 10:19 AM, Abigail wrote: > On Fri, Nov 02, 2007 at 06:05:11AM +0100, A. Pagaltzis wrote: > > * Chris Devers [2007-11-02 04:55]: > > > Anything beyond rudimentary find has always scared me into > > > laziness. > > > > Would that every system I touch had Perl and the File::Find::Rule

Re: find . -print0 -name 'foo' | xargs rm

2007-11-02 Thread A. Pagaltzis
Hi Abigail, * Abigail [2007-11-02 10:30]: > On Fri, Nov 02, 2007 at 06:05:11AM +0100, A. Pagaltzis wrote: > > Would that every system I touch had Perl and the > > File::Find::Rule module installed. > > File::Find confuses me. File::Find::Rule -- not File::Find. File::Find is a pain and a half.

Re: find . -print0 -name 'foo' | xargs rm

2007-11-02 Thread David Cantrell
On Thu, Nov 01, 2007 at 06:35:57PM -0500, Peter da Silva wrote: > There's nothing crazy about it at all. It's not a flag, if it was a > flag it would be a single character (this is a good decade and a hlaf > before that crazy GNU getopt shit). Even without that crazy GNU getopt shit -print co

Re: find . -print0 -name 'foo' | xargs rm

2007-11-02 Thread David Cantrell
On Fri, Nov 02, 2007 at 12:56:49AM +0100, A. Pagaltzis wrote: > > On Thu, Nov 01, 2007 at 04:03:20PM -0700, Michael G Schwern wrote: > > > $ find . -print0 -name '*.txt' | xargs -0 rm > Except that's a red herring, because if he had but `-exec rm \;` > where he put his `-print0`, the exact same t

Re: find . -print0 -name 'foo' | xargs rm

2007-11-02 Thread Rafael Garcia-Suarez
On 02/11/2007, sabrina downard wrote: > > zsh is a whole new category of hate, as far as I'm concerned. > > zsh is the weirdest shell I've ever used. That hasn't stopped me from > adopting it as my login shell, but it keeps giving me occasions to say > "what the fuck? that shouldn't have worked."

Re: find . -print0 -name 'foo' | xargs rm

2007-11-02 Thread sabrina downard
> zsh is a whole new category of hate, as far as I'm concerned. zsh is the weirdest shell I've ever used. That hasn't stopped me from adopting it as my login shell, but it keeps giving me occasions to say "what the fuck? that shouldn't have worked." Like the first time when I did something like "

Re: find . -print0 -name 'foo' | xargs rm

2007-11-02 Thread Peter da Silva
On 02-Nov-2007, at 04:57, Smylers wrote: Peter da Silva writes: There's nothing crazy about [-print] at all. It's not a flag, if it was a flag it would be a single character Then there's things like like -maxdepth. The QNX man pages for find document where each option came from. That's us

Re: find . -print0 -name 'foo' | xargs rm

2007-11-02 Thread Peter da Silva
On 02-Nov-2007, at 04:35, Martin Ebourne wrote: Was GNU really the first to make -print optional though? It's been optional on most unixen for a long time, E... no? certainly HP-UX from nearly 20 years ago, If so it was HP's own perversion. SYS V, Not up through SVR2. BSD (not su

Re: find . -print0 -name 'foo' | xargs rm

2007-11-02 Thread Peter da Silva
On 02-Nov-2007, at 00:39, Phil Pennock wrote: zsh% rm **/*.txt zsh is a whole new category of hate, as far as I'm concerned. Especially when you have a PFY who loves zsh and uses it for scripting after you've told him not to. And then leaves.

Re: find . -print0 -name 'foo' | xargs rm

2007-11-02 Thread Smylers
Peter da Silva writes: > There's nothing crazy about [-print] at all. It's not a flag, if it > was a flag it would be a single character Then there's things like like -maxdepth. FreeBSD find doesn't include it in the list of 'options', instead categorizing it as a 'primary', but it carries this

Re: find . -print0 -name 'foo' | xargs rm

2007-11-02 Thread Martin Ebourne
Jonathan Stowe wrote: On Thu, 2007-11-01 at 18:35 -0500, Peter da Silva wrote: And then they should have realised that those crazy GNU guys would make the final "-print" optional, so it looked even more like a flag. Because it's not. Yes it was at this point that I started to realize somethin

Re: find . -print0 -name 'foo' | xargs rm

2007-11-02 Thread Abigail
On Fri, Nov 02, 2007 at 06:05:11AM +0100, A. Pagaltzis wrote: > * Chris Devers [2007-11-02 04:55]: > > Anything beyond rudimentary find has always scared me into > > laziness. > > Would that every system I touch had Perl and the File::Find::Rule > module installed. Given > > alias ffr='perl

Re: find . -print0 -name 'foo' | xargs rm

2007-11-02 Thread Jonathan Stowe
On Thu, 2007-11-01 at 18:35 -0500, Peter da Silva wrote: > And then they should have realised that those crazy GNU guys would > make the final "-print" optional, so it looked even more like a flag. > Because it's not. Yes it was at this point that I started to realize something was wrong with

Re: find . -print0 -name 'foo' | xargs rm

2007-11-02 Thread Martin Ebourne
On Thu, 2007-11-01 at 20:20 -0700, Michael G Schwern wrote: > Martin Ebourne wrote: > > One of the rules to save your bacon, just like you should always > > 'select ... from ... where ...' before you 'delete from ... where ...', > > 'find ... -print' before you 'find ... -exec rm \;' or xargs equiv

Re: find . -print0 -name 'foo' | xargs rm

2007-11-02 Thread Phil Pennock
On 2007-11-01 at 23:50 -0400, Chris Devers wrote: > $ cd ~/Movies/NOVA > $ find . | grep '\.txt$' # just to skim the list & be sure... > $ rm */*/*.txt > > Hm? > > Then repeat the `find . | grep ...` to verify you got them all. > > If there's some another level down, no problem: >

Re: find . -print0 -name 'foo' | xargs rm

2007-11-02 Thread A. Pagaltzis
* Chris Devers [2007-11-02 04:55]: > Anything beyond rudimentary find has always scared me into > laziness. Would that every system I touch had Perl and the File::Find::Rule module installed. Given alias ffr='perl -MFile::Find::Rule' Michael's original example would be ffr -e'unlink f

Re: find . -print0 -name 'foo' | xargs rm

2007-11-02 Thread Chris Devers
On Thu, 1 Nov 2007, Michael G Schwern wrote: > I want to delete a bunch of unnecessary text files in a pile of NOVA episodes > I have archived. Ok, no problem... Anything beyond rudimentary find has always scared me into laziness. If the .txt files are all known to be at the same depth, why no

Re: find . -print0 -name 'foo' | xargs rm

2007-11-02 Thread Peter da Silva
On 01-Nov-2007, at 22:27, Michael G Schwern wrote: That you say that like it should be obvious is, in and of itself, crazy. When find was written, it was obvious. That it's become crazy is hateful. Or, maybe, 15 years later, we'd be using something better than find. You have a C compile

Re: find . -print0 -name 'foo' | xargs rm

2007-11-02 Thread Peter da Silva
On 01-Nov-2007, at 21:34, A. Pagaltzis wrote: find . \( -name 'foo*' -o -name '*bar' \) -prune -o -exec rm {} \; There's no nested quotes there. That's barely quoting heck. It's when you find yourself faced with 'if("'"$A"'" = $0)' and you need to put THAT inside `` and you're trying to

Re: find . -print0 -name 'foo' | xargs rm

2007-11-02 Thread Peter da Silva
On 01-Nov-2007, at 19:56, Aaron Crane wrote: .sh BUGS Syntax should be reconciled with .it if. The way "if" and kin worked in v6 sucked dead hairy wombats, though.

Re: find . -print0 -name 'foo' | xargs rm

2007-11-02 Thread Michael G Schwern
H.Merijn Brand wrote: > Would it? Is {} the default arg somehow? > > find . -exec rm {} \; -name '*.txt' > ^^ > > would have given you at least loads of errors about the directories > that cannot be removed with rm :) Got those with xargs, too, which was when I realized something

Re: find . -print0 -name 'foo' | xargs rm

2007-11-02 Thread Michael G Schwern
Peter da Silva wrote: > On 01-Nov-2007, at 18:03, Michael G Schwern wrote: >> $ find . -print0 -name '*.txt' | xargs -0 rm > > That's a mistake. THANK YOU CAPTAIN OBVIOUS! >> Whoopsie, everything's deleted. 10 gigs of fine public educational >> video, >> gone. Turns out putting -print0 fi

Re: find . -print0 -name 'foo' | xargs rm

2007-11-02 Thread Michael G Schwern
Martin Ebourne wrote: > One of the rules to save your bacon, just like you should always > 'select ... from ... where ...' before you 'delete from ... where ...', > 'find ... -print' before you 'find ... -exec rm \;' or xargs equivalent. No, you turn off autocommit, you maniac. Which reminds me,

Re: find . -print0 -name 'foo' | xargs rm

2007-11-02 Thread A. Pagaltzis
* Peter da Silva [2007-11-02 01:31]: > On 01-Nov-2007, at 19:16, A. Pagaltzis wrote: >> So they should have done what sed and awk do and made >> expression a string passed either as first parameter or as an >> argument to the an -e switch. > > That leads to quoting hell, which find is trying to av

Re: find . -print0 -name 'foo' | xargs rm

2007-11-02 Thread Aaron Crane
Peter da Silva writes: > there's always been some people complaining about find being some > kind of exception because it uses those crazy long options. It's > not, it's consistent, it's just hateful. Well, it's consistent with itself, sure, but hardly with the rest of Unix of that vintage. I'm r

Re: find . -print0 -name 'foo' | xargs rm

2007-11-02 Thread Phil Pennock
On 2007-11-01 at 19:24 -0500, Peter da Silva wrote: > On 01-Nov-2007, at 19:16, A. Pagaltzis wrote: >> Well find will get on your case if you mix paths and predicates >> anyway. > > Yes, they could have just had one token to say "that's the last file, the > rest is an expression". That would also

Re: find . -print0 -name 'foo' | xargs rm

2007-11-02 Thread Peter da Silva
On 01-Nov-2007, at 19:16, A. Pagaltzis wrote: Well find will get on your case if you mix paths and predicates anyway. Yes, they could have just had one token to say "that's the last file, the rest is an expression". That would also have worked. So they should have done what sed and awk do

Re: find . -print0 -name 'foo' | xargs rm

2007-11-02 Thread A. Pagaltzis
* Peter da Silva [2007-11-02 00:40]: > It's a term in an expression. The hateful thing isn't that it > behaved that way, it's that they put a "-" in front of the > terms in the expression instead of something else like "+" or > "=" so you wouln't think it was some kind of long format > option. We

Re: find . -print0 -name 'foo' | xargs rm

2007-11-02 Thread Michael Jinks
On Fri, Nov 02, 2007 at 12:56:49AM +0100, A. Pagaltzis wrote: > * Michael Jinks [2007-11-02 00:30]: > > On Thu, Nov 01, 2007 at 04:03:20PM -0700, Michael G Schwern wrote: > > > > Since I learned how to make -exec do my bidding, I think I can > > count on one hand the number of times I've had to h

Re: find . -print0 -name 'foo' | xargs rm

2007-11-02 Thread H.Merijn Brand
On Fri, 2 Nov 2007 00:56:49 +0100, "A. Pagaltzis" wrote: > * Michael Jinks [2007-11-02 00:30]: > > On Thu, Nov 01, 2007 at 04:03:20PM -0700, Michael G Schwern wrote: > > > > > > $ find . -print0 -name '*.txt' | xargs -0 rm > > > > I hates xargs. It has its place I guess, but this ain't it,

Re: find . -print0 -name 'foo' | xargs rm

2007-11-02 Thread A. Pagaltzis
* Michael Jinks [2007-11-02 00:30]: > On Thu, Nov 01, 2007 at 04:03:20PM -0700, Michael G Schwern wrote: > > > > $ find . -print0 -name '*.txt' | xargs -0 rm > > I hates xargs. It has its place I guess, but this ain't it, > and souping up GNU find to (try to, sometimes) feed nice path > nam

Re: find . -print0 -name 'foo' | xargs rm

2007-11-02 Thread Peter da Silva
On 01-Nov-2007, at 18:03, Michael G Schwern wrote: $ find . -print0 -name '*.txt' | xargs -0 rm That's a mistake. Whoopsie, everything's deleted. 10 gigs of fine public educational video, gone. Turns out putting -print0 first instead of last causes some sort of crazy find switch

Re: find . -print0 -name 'foo' | xargs rm

2007-11-02 Thread Martin Ebourne
On Thu, 2007-11-01 at 16:03 -0700, Michael G Schwern wrote: > Oh that's right, in Unix nobody would ever possibly put a space in a filename > (a hate for later). So I need to separate things with a null byte, ok... > > $ find . -print0 -name '*.txt' | xargs -0 rm > > Whoopsie, everything's

Re: find . -print0 -name 'foo' | xargs rm

2007-11-02 Thread Michael Jinks
On Thu, Nov 01, 2007 at 04:03:20PM -0700, Michael G Schwern wrote: > > $ find . -print0 -name '*.txt' | xargs -0 rm I hates xargs. It has its place I guess, but this ain't it, and souping up GNU find to (try to, sometimes) feed nice path names to xargs seems only to have made GNU find that

find . -print0 -name 'foo' | xargs rm

2007-11-02 Thread Michael G Schwern
I want to delete a bunch of unnecessary text files in a pile of NOVA episodes I have archived. Ok, no problem... $ cd ~/Movies/NOVA/ $ find . -name '*.txt' | xargs rm rm: cannot remove `./NOVA': No such file or directory rm: cannot remove `-': No such file or direc