delorie.com/archives/browse.cgi | search |
X-Spam-Check-By: | sourceware.org |
Date: | Fri, 30 Jun 2006 11:44:47 +0100 |
From: | Owen Rees <owen DOT rees AT hp DOT com> |
To: | cygwin AT cygwin DOT com |
Subject: | Re: find missing parameter |
Message-ID: | <9BEEDDBA7B29B781CF02BF69@rees-o-3.labs.hpl.hp.com> |
In-Reply-To: | <44A4F211.F8B11DC1@dessent.net> |
References: | <5116344 DOT post AT talk DOT nabble DOT com> <44A4F211 DOT F8B11DC1 AT dessent DOT net> |
X-Mailer: | Mulberry/4.0.4 (Win32) |
MIME-Version: | 1.0 |
X-IsSubscribed: | yes |
Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
List-Unsubscribe: | <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com> |
List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
List-Archive: | <http://sourceware.org/ml/cygwin/> |
List-Post: | <mailto:cygwin AT cygwin DOT com> |
List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
Sender: | cygwin-owner AT cygwin DOT com |
Mail-Followup-To: | cygwin AT cygwin DOT com |
Delivered-To: | mailing list cygwin AT cygwin DOT com |
--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/
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |