[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [bash] script (redirect output) to file and email



Enrico Weigelt:
> * Jochen Schulz <ml@well-adjusted.de> schrieb:
> 
>> - You are starting an rm process for every file to delete. You can end
>>   the command with "+" instead of "\;" to make find pass as many files
>>   to rm as possible. If you delete many files that way, that may make a
>>   big difference spped-wise.
> 
> But you have to be careful that the command line doesnt get too long.

No, find does that for you.

> If you're really concerned about perfomance, you could use busybox
> (with all commands compiled-in) as shell do write your script this way:
> 
>     do_rm() {
> 	while read FILE ; do rm -fr $FILE ; done
>     }

That won't work with spaces in filenames. :) "find … -exec" or "find …
-print0 | xargs -0" are the best ways to do this. Apart from "find …
-delete" which I regularly forget. :)

J.
-- 
When driving at night I find the headlights of oncoming vehicles very
attractive.
[Agree]   [Disagree]
                 <http://www.slowlydownward.com/NODATA/data_enter2.html>

Attachment: signature.asc
Description: Digital signature


Reply to: