[PLUG] find | grep | xargs ...

Matt Whiteley matt-whiteley at attbi.com
Wed Mar 5 17:40:04 UTC 2003


On Tue, 2003-03-04 at 20:58, Sandy Herring wrote:
> I suspect the problem is more to do with file names with single quotes that
> you're parsing than with underscores. You shouldn't need all those pipes or
> xargs...
> 
> [bigfish at kippered findtest]$ ls -R
> .:
> a  b  c  DS_store  findtest2
> 
> ./findtest2:
> 1  2  3  DS_store  findtest3a  findtest3b
> 
> ./findtest2/findtest3a:
> herring
> 
> ./findtest2/findtest3b:
> DS_store
> [bigfish at kippered findtest]$ find . -name DS_store -exec rm {} \;
> [bigfish at kippered findtest]$ ls -R
> .:
> a  b  c  findtest2
> 
> ./findtest2:
> 1  2  3  findtest3a  findtest3b
> 
> ./findtest2/findtest3a:
> herring
> 
> ./findtest2/findtest3b:
> [bigfish at kippered findtest]$
> 
> Sandy
> 
> On Tue, 04 Mar 2003, Matt Whiteley wrote: 
> > I am trying to recursively delete all files with the name "DS_Store" in
> > a certain directory path.  I had come up with the command 'find . | grep
> > DS_Store | xargs rm -v' however I get the error "unmatched single
> > quote"  From my testing it appears to be because of the underscore
> > character not parsing through xargs properly.  Is there a better way to
> > get what I want done?  In perl maybe?
> > 
> > thanks,
> > 
> > -- 
> > Matt Whiteley <matt-whiteley at attbi.com>

I had not tried this as I have been wary by lack of experience of using
exec.  It looks like it would work though.  Basically I ripped my cds on
my powerbook in iTunes then tried to store them on my linux box where
there is lots more space.  I just copied over the directories completely
and they had a lot of unwanted hidden files (for the iTunes xml database
I assume)

thanks,

-- 
Matt Whiteley <matt-whiteley at attbi.com>





More information about the PLUG mailing list