From owner-freebsd-questions@FreeBSD.ORG Fri Nov 19 09:19:41 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 5D1F316A4CE for ; Fri, 19 Nov 2004 09:19:41 +0000 (GMT) Received: from hobbit.neveragain.de (neveragain.de [217.69.76.1]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9CBBE43D39 for ; Fri, 19 Nov 2004 09:19:40 +0000 (GMT) (envelope-from amf@hobbit.neveragain.de) Received: from hobbit.neveragain.de (amf@localhost [127.0.0.1]) iAJ9JdCv012144 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 19 Nov 2004 10:19:39 +0100 Received: (from amf@localhost) by hobbit.neveragain.de (8.13.1/8.13.1/Submit) id iAJ9JdFS012143; Fri, 19 Nov 2004 10:19:39 +0100 Date: Fri, 19 Nov 2004 10:19:39 +0100 From: Dennis Koegel To: Mipam Message-ID: <20041119091938.GA964@neveragain.de> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-PGP-KeyID: 0D73E19A User-Agent: Mutt/1.5.6+20040722i X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-1.4 (hobbit.neveragain.de [127.0.0.1]); Fri, 19 Nov 2004 10:19:39 +0100 (CET) cc: freebsd-questions@freebsd.org Subject: Re: /bin/rm: Argument list too long. 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: Fri, 19 Nov 2004 09:19:41 -0000 On Fri, Nov 19, 2004 at 09:58:40AM +0100, Mipam wrote: > I tried to delete all files from a dir, however I got this message: > /bin/rm: Argument list too long. You probably did "rm *", and * expanded to too many files. One way is to simply remove the directory completely (rm -r /foo/bar), but this also removes all subdirectories. Other way would be to use find and xargs; in this example for only the files in one specific directory and no subdirectories (and no symlinks, that is): find /foo/bar -type f -maxdepth 1 | xargs rm -n100 ... where -n controls the number of arguments passed per one execution of rm. HTH, - D.