From owner-freebsd-questions Wed Aug 12 08:36:23 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id IAA12264 for freebsd-questions-outgoing; Wed, 12 Aug 1998 08:36:23 -0700 (PDT) (envelope-from owner-freebsd-questions@FreeBSD.ORG) Received: from mailhost.criterion.canon.co.uk (cruella.criterion.canon.co.uk [194.223.249.254]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id IAA12255 for ; Wed, 12 Aug 1998 08:36:19 -0700 (PDT) (envelope-from adamn@criterion.canon.co.uk) Received: from criterion.canon.co.uk (hermes.criterion.canon.co.uk [194.223.249.13]) by mailhost.criterion.canon.co.uk (8.8.8/8.7.3) with ESMTP id QAA04249 for ; Wed, 12 Aug 1998 16:30:55 +0100 (BST) Message-ID: <35D1B4AC.A880990F@criterion.canon.co.uk> Date: Wed, 12 Aug 1998 16:28:44 +0100 From: Adam Nealis Organization: Criterion Software, Ltd. X-Mailer: Mozilla 4.05 [en] (X11; I; Linux 2.0.34 i686) MIME-Version: 1.0 To: freebsd-questions@FreeBSD.ORG Subject: Re: removing files References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Thierry.Herbelot@alcatel.fr wrote: > Hello, > > what about : (under csh) > > foreach i (`ls | grep -v la.txt | grep -v foo.sh`) > rm $i > end ls can complain if you have (a zillion)^zillion files in a dir, so I'd be inclined to do find . -type f -print > /tmp/bigffilelist foreach i (`grep -v la.txt /tmp/bigfilelist`) rm $i end Coz find just reads the entries in the directory file one by one, unlike ls which tries to sort the buggers. Also a bit faster because there is no sort. Adam. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message