bugfindutils - Bugs: bug #35141, [feature_request] -prune0 action,...

 
 

bug #35141: [feature_request] -prune0 action, or a -0 option

Submitted by:  Gavin Beatty <gavinbeatty>
Submitted on:  Wed 21 Dec 2011 09:09:13 AM UTC  
 
Category: findSeverity: 3 - Normal
Item Group: NoneStatus: Invalid
Privacy: PublicAssigned to: None
Originator Name: Open/Closed: Closed
Release: 4.2.27Fixed Release: None

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Wed 21 Dec 2011 01:00:23 PM UTC, comment #1:

Such an option already exists; it is named -print0.

Remember, if you don't specify any of the -ok, -exec, or -print family of outputs, then find defaults to -print (not -print0). -prune does not print, rather, the lack of any other action implies the default of -print. Your example was thus parsed as:

find . \( -name 'bin*' -type d -prune \) -print | xargs -r rm -r --

when it sounds like you wanted something like:

find . -name 'bin*' -type d -prune -o -print0 | xargs -r rm -r --

or even more efficiently:

find -name 'bin*' -type d -prune -o -delete

I'm closing this as not a bug; there is no need to add -prune0 as a NUL-printing counterpart of -prune, since -prune doesn't print in the first place.

Eric Blake <ericb>
Project Administrator
Wed 21 Dec 2011 09:09:13 AM UTC, original submission:

All actions whose main use is to give useful output (to send to xargs, etc.) should have a NUL-separated alternate. -prune does not have this.

find . -name 'bin*' -type d -prune | xargs -r rm -r --

But, what about unusual directory names for 'bin*' matches?

Gavin Beatty <gavinbeatty>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by ericb (Posted a comment)
  • -unavailable- added by gavinbeatty (Submitted the item)
  • -unavailable- added by gavinbeatty
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 3 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Wed 21 Dec 2011 01:00:23 PM UTCericbStatusNone=>Invalid
      Open/ClosedOpen=>Closed
    Wed 21 Dec 2011 09:09:13 AM UTCgavinbeattyCarbon-Copy-=>Added -unavailable-

    Back to the top


    Powered by Savane 3.1-cleanup1