help with command line deletion

Norman Gray norman at astro.gla.ac.uk
Thu Apr 19 08:19:49 PDT 2007


Martin, hello.

On 2007 Apr 19 , at 11.24, Martin Costabel wrote:

> Norman Gray wrote:
> []
>> find has some funky flag or not, and I don't have to read the find  
>> manpage (again) to remind myself of the syntax,
>
> And you keep the syntax of the "0" in find -print0 and xargs -0 in  
> your head? Good for you. Or do you take the risk of getting bitten  
> by spaces in directory names? If I use a pipe between find and  
> xargs, I usually have to read two man pages instead of one :-(

A good point, but yes, I do remember the -print0/-0 trick.  Because I  
use a Mac, it's natural to remember about spaces in paths, and in  
consequence I tend to think of them on other unixes as well; because  
I use it fairly often, the -print0/-0 wrinkle sticks in my head.

My claim is not that the pipe technique is less exotic than the  
precise syntax of and support for -delete, but that, once  
internalised, the pipe technique is more general.

Thus returning to the OP's question, yes, the various suggestions  
about which 'find' options would solve his problem were manifestly  
correct and informative, but the subtleties involved in getting the  
pipe+xargs technique correct (ie, -0) are additionally useful for  
other cases where you'd want to do something to a long list of files.

It's a `teach a man to fish...' remark.  Which are key techniques,  
and which are wrinkles?

All the best,

Norman


-- 
------------------------------------------------------------------
Norman Gray  :  http://nxg.me.uk
eurovotech.org  :  University of Leicester, UK




More information about the MacOSX-admin mailing list