Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Click here to return to the 'One liner...' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
One liner...
Authored by: vasi on Nov 26, '02 10:34:22AM

It's usually considered more efficient to use xargs:

find / -name ".DS_Store" -print0 | xargs -0 rm


[ Reply to This | # ]
xargs is not safe
Authored by: fredcondo on Nov 26, '02 12:02:57PM

xargs will choke on any paths that contain spaces, a common occurrence on Macs. Probably the safest command on a Mac is this:

sudo find / -name .DS_Store -print -exec rm -f "{}" \;

[ Reply to This | # ]
xargs is not safe
Authored by: kent37 on Nov 26, '02 12:24:07PM

Don't the -print0 and -0 make xargs process spaces correctly?

[ Reply to This | # ]
xargs -0 is safe
Authored by: Bernd P. Ziller on Nov 26, '02 12:45:31PM

Using 'find -print0 | xargs -0' is safe.

The pathname will be printed followed by an ASCII NUL character, and xargs will use the ASCII NUL as argument separator.

Perfectly safe...

[ Reply to This | # ]
One liner...
Authored by: stoltz on Dec 02, '02 02:51:44AM
find / -xdev -name .DS_Store -print0 | xargs -0 rm -f

I prefer not to descend into network mounted drives, CDROMs, etc., hence the -xdev flag. Add /Volumes/Disk23 and such to explicitly search those disks as well.

[ Reply to This | # ]