This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: find missing parameter


--On 30 June 2006 02:42 -0700 Brian Dessent wrote:

First, -exec is a bad way to do this.  It will have to fork/exec a copy
of rm once for each file to be deleted, which is extraordinarily slow
under Cygwin.  Use xargs instead:

find . -name db\* -mtime +2 -type f -print0 | xargs -0 rm

This will result in rm being called only once with all the filenames to
delete as arguments (unless the total length is too great to fit on one
command line, in which case rm will be called as many times as
necessary, but still much less than once per file.)

Provided that your version of cygwin (specifically findutils) is reasonable recent, you can use


find . -name "db*" -mtime +2 -type f -exec /bin/rm {} +

to do more or less the same as with xargs.

--
Owen Rees
Hewlett Packard Laboratories, Bristol, UK



--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]