[NCLUG] Find, grep and other pointy instruments

Michael Dwyer mdwyer at sixthdimension.com
Mon Apr 23 09:24:44 MDT 2001


From: "S. Luke Jones" <luke at frii.com>
> Michael Dwyer wrote:
> > I'm looking for a way to do this:
> > 
> >   find / -print | grep "everything unless it is a directory which
> > includes a specific file"
> 
> Do you mean, find everything under / and whenever you find a
> specific file you want to omit that entire directory, including
> things that aren't the specific file?
> So what the heck are you trying to do here, anyway, Michael?

I mean, lets say that, because I am really tired of hunting down a 
linux disk when I need one, I have started copying the images down
to a hard drive.  However, I don't want to take the 600MB hit on
my backup tapes when logically, I already have the data backed-up
on the original CD-Rom media.  I could drop a file called 
"DO-NOT-BACKUP" into the directory, and when the backup script
found that file, it would exclude everything in that directory
from backups. Or maybe one of my users is keeping all their MP3s
on my server. Its probably not-quite-legal for me to be even 
holding them, let alone backing them up every week.  So, the 
user could just drop a "DO-NOT-BACKUP" file (touch DO-NOT-BACKUP)
and I would be happy.

~ (HOME)
 | Blah.m4
 | Blah.pl
 +- Important Docs
   | Blah.txt
   | Blah.foo
 +- Music
   | DO-NOT-BACKUP
   | Foo1.mp3
   +- Country
     | Foo2.mp3
   | Foo3.mp3

So in this case, the system would back up all the BLAH, but none
of the FOO.  (Read that out-loud.  It'll make you smile.)  So a
flag file in a directory means "Exclude this directory, and everything
below it."






More information about the NCLUG mailing list