*BSD News Article 70439


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!news.rmit.EDU.AU!news.unimelb.EDU.AU!munnari.OZ.AU!metro!metro!asstdc.scgt.oz.au!nsw.news.telstra.net!act.news.telstra.net!vic.news.telstra.net!news.mira.net.au!news.vbc.net!garlic.com!news.scruz.net!kithrup.com!news.Stanford.EDU!newshub.internex.net!newshub1.internex.net!news.sprintlink.net!news-stk-11.sprintlink.net!southwind.net!jade!stehman
From: stehman@jade.southwind.net (Jeff Stehman)
Newsgroups: comp.unix.bsd.bsdi.misc
Subject: Re: Stupid Question
Date: 7 Jun 1996 21:16:00 GMT
Organization: SouthWind Internet Access, Inc.
Lines: 38
Message-ID: <4pa66g$f3d@opal.southwind.net>
References: <31b82713.17325318@news.newreach.net>
NNTP-Posting-Host: jade.southwind.net
X-Newsreader: TIN [version 1.2 PL2]

Dave A. Flanigan (entropy@newreach.net) wrote:
: Is there a simple command that I can use in BSDI to telete every
: occurance of a particular filename? Like if I wanted to delete every
: rhosts file on my system, any other file.
: 	
: 	I figured some varation of Find would work, but I cannot seem
: to put together one that works... and I am loth to experiment to much.

Always a good idea not to experiment from root. :-)

	find . -name foo.bar -exec rm {} \;

would be a simple way to remove all foo.bar files in or below the current
directory.  When doing something like this system wide, I like to run a
safe version first:

	find . -name foo.bar -exec ls -l {} \;

just to make sure I know what I'm getting into-- particularly if I'm
removing something involving a wild card ('*.core' for example).  BSD/OS's
find supports -ls, but I like the command to be very close to the rm
version I'll be using.

On systems with sizable NFS mounted filesystems I usually prune them:

	find . ! \( -fstype nfs -prune \) -name foo.bar...

(I learned the "never let find go into an NFS mounted file system unless
you intentionally send it there" lesson a long time ago. :-)

Create a few subdirectories and files so you can experiment from a
regular account.

--
Jeff Stehman                     Senior Systems Administrator
stehman@southwind.net            SouthWind Internet Access, Inc.
voice: (316)263-7963             Wichita, KS
URL for Wichita Area Chamber of Commerce:  http://www.southwind.net/ict/