From owner-freebsd-questions@FreeBSD.ORG Tue Jul 6 14:28:23 2004 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id BB25116A4CE for ; Tue, 6 Jul 2004 14:28:23 +0000 (GMT) Received: from mail.u4eatech.com (blackhole.u4eatech.com [195.188.241.2]) by mx1.FreeBSD.org (Postfix) with ESMTP id DFEF243D46 for ; Tue, 6 Jul 2004 14:28:22 +0000 (GMT) (envelope-from richard.williamson@u4eatech.com) Received: by mail.u4eatech.com (Postfix, from userid 503) id 90C5A36046C; Tue, 6 Jul 2004 15:28:21 +0100 (BST) Received: from apus.u4eatech.com (apus.degree2.com [172.30.40.129]) (using TLSv1 with cipher DES-CBC3-SHA (168/168 bits)) (No client certificate requested) by mail.u4eatech.com (Postfix) with ESMTP id A60743603CF; Tue, 6 Jul 2004 15:28:18 +0100 (BST) Message-Id: <6.1.1.1.2.20040706152727.027847e8@cygnus> X-Sender: richard@cygnus X-Mailer: QUALCOMM Windows Eudora Version 6.1.1.1 Date: Tue, 06 Jul 2004 15:30:43 +0100 To: "Steve Bertrand" , questions@freebsd.org From: "Richard P. Williamson" In-Reply-To: <3703.209.167.16.15.1089123354.squirrel@209.167.16.15> References: <3703.209.167.16.15.1089123354.squirrel@209.167.16.15> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on mail X-Spam-Level: X-Spam-Status: No, hits=-4.9 required=5.0 tests=BAYES_00 autolearn=ham version=2.63 Subject: Re: Removing thousands of files using rm X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Jul 2004 14:28:23 -0000 At 15:15 06/07/2004. Steve Bertrand had this to say: >I often have the need to remove hundreds or even thousands of files from a >single directory (very often). Using rm, I usually get: > >pearl# rm -rvf * >/bin/rm: Argument list too long. > >Is there any way to work around this instead of having to select a small >bunch of files at a time to remove? find /path/to/dir -exec rm -rvf {} \; use /path/to/dir instead of cd /path/to/dir; find . ... because it is very easy to forget the cd /path/to/dir step. Doing find . -exec rm -rvf {} \; in, for example, / is Not Recommended(tm) Also, there is a space between the {} and the \;, don't skip it, as cryptic error messages result. man find for more info on what you can do with find. HTH, rip