Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 12 Aug 1998 16:28:44 +0100
From:      Adam Nealis <adamn@criterion.canon.co.uk>
To:        freebsd-questions@FreeBSD.ORG
Subject:   Re: removing files
Message-ID:  <35D1B4AC.A880990F@criterion.canon.co.uk>
References:  <H000057c01776e2a@MHS>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?35D1B4AC.A880990F>