Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 12 Aug 1998 09:15:43 -0700 (PDT)
From:      David Wolfskill <dhw@whistle.com>
To:        freebsd-questions@FreeBSD.ORG, romank@graphnet.com
Subject:   Re: removing files
Message-ID:  <199808121615.JAA20878@pau-amma.whistle.com>
In-Reply-To: <35D195D9.CD9E1460@graphnet.com>

next in thread | previous in thread | raw e-mail | index | archive | help
>Date: Wed, 12 Aug 1998 09:17:13 -0400
>From: Roman Katsnelson <romank@graphnet.com>

>Let's say I have a directory with la.txt and foo.sh and 6 million other
>files.

>Can I issue a command that says: delete everything BUT la.txt and foo.sh

>According to man rm there's no way to do it with that one. Is there an
>alternative?

How about

	rm `ls | egrep -v '^la\.txt|foo\.sh$'`

?

david
-- 
David Wolfskill		UNIX System Administrator
dhw@whistle.com		voice: (650) 577-7158	pager: (650) 371-4621

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?199808121615.JAA20878>