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

 
 

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

Submitter:  Gavin Beatty <gavinbeatty>
Submitted:  Wed 21 Dec 2011 09:09:13 AM UTC
   
 
Category:  find Severity:  3 - Normal
Item Group:  None Status:  Invalid
Privacy:  Public Assigned to:  None
Originator Name:  Open/Closed:  Closed
Release:  4.2.27 Fixed Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

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>
Group 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 Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2011-12-21 ericb StatusNone Invalid
        Open/ClosedOpen Closed
    2011-12-21 gavinbeatty Carbon-Copy- Added -email is unavailable-

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code