Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 26 Aug 2000 14:54:31 +0400
From:      Igor Roboul <igor@raduga.dyndns.org>
To:        freebsd-questions@FreeBSD.ORG
Subject:   Re: how to delete all files but the XYZ file.
Message-ID:  <20000826145431.A28124@linux.rainbow>
In-Reply-To: <Pine.BSF.4.21.0008262017550.14504-100000@backup.af.speednet.com.au>; from andyf@speednet.com.au on Sat, Aug 26, 2000 at 08:18:52PM %2B1000
References:  <20000826125613.B27330@linux.rainbow> <Pine.BSF.4.21.0008262017550.14504-100000@backup.af.speednet.com.au>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, Aug 26, 2000 at 08:18:52PM +1000, Andy Farkas wrote:
> 
> 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?
.preserve is just _directory_ if you like then you can name it PROTECT :-)
It's why I asked does your directory contain any subdirs?
If it contain subdirs then you'll need change script.

-- 
Igor Roboul, Unix System Administrator & Programmer @ sanatorium "Raduga"
http://www.brainbench.com/transcript.jsp?pid=304744


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?20000826145431.A28124>