|
|
Find can exec commands too
even better, use xargs. the -exec flag does a fork for each and every file. (i.e., a new process is launched for each file!)
with xargs, there will only be the find process, the xargs process, and a few rm processes (eventually the command line to rm will get too long and xargs will have to launch another rm). when you have an imap inbox with 9000 messages in it like I do it's a big deal. I ran the first find without removing the files, just piping the list of files to 'wc' to see how many there were. there were 20560 files! In my case, I'll get about 20 processes launched using xargs, as opposed to 20561 if I use the -exec flag. try this:
(the -print0 and -0 arguments are just to take care of files with spaces in the name; they are 'zeros' not 'ohs') the first find command (which deleted 20000 files) only took 48seconds on my 700Mhz g3 ibook. before deleting all those files, my ~/Library/Mail was 1.3G, afterwards it was only 677MB. and mail.app still works fine, so those seem to be the correct files to delete.
Find can exec commands too
I'm been using find and exec for a while now, but I didn't know that xargs forked once (generally). I'll have to try to get used to using it instead, and I know the overhead for some of the find -exec commands I've run is noticable, so this should save a lot. |
SearchFrom our Sponsor...Latest Mountain Lion HintsWhat's New:HintsNo new hintsComments last 2 daysLinks last 2 weeksNo recent new linksWhat's New in the Forums?
Hints by TopicNews from Macworld
From Our Sponsors |
|
Copyright © 2014 IDG Consumer & SMB (Privacy Policy) Contact Us All trademarks and copyrights on this page are owned by their respective owners. |
Visit other IDG sites: |
|
|
|
Created this page in 0.09 seconds |
|