From owner-freebsd-questions Sat Aug 26 3:19:18 2000 Delivered-To: freebsd-questions@freebsd.org Received: from backup.af.speednet.com.au (af.speednet.com.au [202.135.188.244]) by hub.freebsd.org (Postfix) with ESMTP id 7409637B42C for ; Sat, 26 Aug 2000 03:19:13 -0700 (PDT) Received: from backup.af.speednet.com.au (andyf@backup.af.speednet.com.au [172.22.2.4]) by backup.af.speednet.com.au (8.9.3/8.9.3) with ESMTP id UAA23305; Sat, 26 Aug 2000 20:18:53 +1000 (EST) (envelope-from andyf@speednet.com.au) Date: Sat, 26 Aug 2000 20:18:52 +1000 (EST) From: Andy Farkas X-Sender: andyf@backup.af.speednet.com.au To: igorr@crosswinds.net Cc: freebsd-questions@FreeBSD.ORG Subject: Re: how to delete all files but the XYZ file. In-Reply-To: <20000826125613.B27330@linux.rainbow> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Sat, 26 Aug 2000, Igor Roboul wrote: > On Sat, Aug 26, 2000 at 11:25:00AM +0300, Evren Yurtesen wrote: > > Lets say I have 1230 files in one directory and I want to delete > > all of the files but not the files named XYZ, XYA, XYB etc. > > I want to do this from shell without using any file managers. (since > > actually I need to do this from a script) > Is there any directories? If no, then how do you think about this? > ----------------------- > mkdir .preserve > mv XY* .preserve > rm -f * > mv .preserve/* . > rmdir .preserve > ----------------------- Where did you learn about .preserve? Is it a shell thing or an rm thing? > > -- > Igor Roboul, Unix System Administrator & Programmer @ sanatorium "Raduga" > http://www.brainbench.com/transcript.jsp?pid=304744 > -- :{ andyf@speednet.com.au Andy Farkas System Administrator Speednet Communications http://www.speednet.com.au/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message