From owner-freebsd-questions@FreeBSD.ORG Sat Feb 11 15:18:47 2012 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D639A106566C for ; Sat, 11 Feb 2012 15:18:47 +0000 (UTC) (envelope-from DStaal@usa.net) Received: from mail.magehandbook.com (173-8-4-45-WashingtonDC.hfc.comcastbusiness.net [173.8.4.45]) by mx1.freebsd.org (Postfix) with ESMTP id 9B69A8FC08 for ; Sat, 11 Feb 2012 15:18:47 +0000 (UTC) Received: from [192.168.1.50] (Mac-Pro.magehandbook.com [192.168.1.50]) by mail.magehandbook.com (Postfix) with ESMTP id 7A9C7DC8 for ; Sat, 11 Feb 2012 10:18:46 -0500 (EST) Date: Sat, 11 Feb 2012 10:17:50 -0500 From: Daniel Staal To: freebsd-questions@freebsd.org Message-ID: <2447CE4E015EBEA182A15517@mac-pro.magehandbook.com> In-Reply-To: <4F3544DA.8010003@infracaninophile.co.uk> References: <1237723287.20120207235924@yandex.ru> <4F31A260.20109@infracaninophile.co.uk> <20120207231716.31aa8bc3@gumby.homeunix.com> <20120209032544.GA58560@ozzmosis.com> <4F353D1F.3020100@herveybayaustralia.com.au> <4F3544DA.8010003@infracaninophile.co.uk> X-Mailer: Mulberry/4.0.8 (Mac OS X) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline Subject: Re: 'rm' Can not delete files X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: FreeBSD Questions List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Feb 2012 15:18:47 -0000 --As of February 10, 2012 4:24:58 PM +0000, Matthew Seaman is alleged to have said: > On 10/02/2012 16:04, Matthew Story wrote: >> find . -type f -depth 1 -print0 | xargs -n99 -0 -s8192 -c5 rm -- >> >> or some such, depending on your needs, I believe in most situations this >> particular invocation will also out-perform find ... -delete. > > Why would you believe that? find ... -delete calls unlink(2) directly on > each file it finds as it searches the directory tree given that it > matches the other find predicates. > > Whereas find ... -print0 | xargs ... rm ... involves a whole complicated > sequence of find doing the same searching and matching job, then > marshalling lists of filenames, piping them between processes, then > xargs exec(2)ing rm with chunks of that arglist; each rm invocation then > finally ... calling unlink(2) on each of the named files. On the other hand, passing it through xargs makes the deletion multi-threaded (well, multi-process), while using -delete keeps it all in one process. Depending on your execution environment, that may be a win. > Actually, I doubt you'ld see much difference above the noise in the > speed of either of those two commands: they're both going to spend the > vast majority of the time waiting for disk IO, and that's common to any > way of doing this job. This is likely the root of the issue however. ;) (There are probably some pathological cases of multi-processor, multi-controller, multi-disk systems where having multiple IO streams would make a difference, but they are likely to be few for something like this.) Daniel T. Staal --------------------------------------------------------------- This email copyright the author. Unless otherwise noted, you are expressly allowed to retransmit, quote, or otherwise use the contents for non-commercial purposes. This copyright will expire 5 years after the author's death, or in 30 years, whichever is longer, unless such a period is in excess of local copyright law. ---------------------------------------------------------------