From owner-freebsd-questions Wed Aug 12 08:49:31 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id IAA14594 for freebsd-questions-outgoing; Wed, 12 Aug 1998 08:49:31 -0700 (PDT) (envelope-from owner-freebsd-questions@FreeBSD.ORG) Received: from cyclone.degnet.baynet.de (www.degnet.baynet.de [194.95.214.129]) by hub.freebsd.org (8.8.8/8.8.8) with SMTP id IAA14585 for ; Wed, 12 Aug 1998 08:49:26 -0700 (PDT) (envelope-from malte.lance@gmx.net) Received: from neuron.webmore.de (unverified [194.95.214.165]) by cyclone.degnet.baynet.de (EMWAC SMTPRS 0.83) with SMTP id ; Wed, 12 Aug 1998 17:50:20 +0200 Received: (from malte.lance@gmx.net) by neuron.webmore.de (8.8.8/8.8.8) id RAA02030; Wed, 12 Aug 1998 17:46:39 +0200 (CEST) From: Malte Lance MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Wed, 12 Aug 1998 17:46:39 +0200 (CEST) To: Roman Katsnelson Cc: "q's" Subject: Re: removing files In-Reply-To: <35D195D9.CD9E1460@graphnet.com> References: <35D195D9.CD9E1460@graphnet.com> X-Mailer: VM 6.43 under 20.4 "Emerald" XEmacs Lucid Message-ID: <13777.47045.480782.154919@neuron.webmore.de> Reply-To: malte.lance@gmx.net Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Roman Katsnelson writes: > Hi, > > Let's say I have a directory with la.txt and foo.sh and 6 million other > files. Let's say that directory is named "/tmp" > > Can I issue a command that says: delete everything BUT la.txt and > foo.sh yes. > > > According to man rm there's no way to do it with that one. Is there an > alternative? Yes. "man grep" is your friend. Try (in [ba]sh-world) : rm -f `/bin/ls /tmp/. | grep -v -e la.txt | grep -v -e foo.sh` The tickmarks are back-ticks ! Malte. > > Thanks, > > Roman > -- > Roman Katsnelson > UNIX Network Engineer > Graphnet, Inc. > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-questions" in the body of the message To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message