Quick scripting question

fred smith fredex at fcshome.stoneham.ma.us
Sat Oct 6 19:05:32 UTC 2007


On Sat, Oct 06, 2007 at 01:52:55PM -0400, Todd Zullinger wrote:
> Chris wrote:
> > How would I script removing a file (globally) ?
> 
> Very carefully. :)

Yes, you need to be very CAREFUL using this suggestion:

There is SUPPOSED to be a program named test on the system, and this
command will remove it.

see:
	ls -l /usr/bin/test
and
	man test

then use this with care.

> 
> > Meaning, say the file name test however, it's in multiple
> > directories throughout the system without having to go into each dir
> > manually.
> 
> This would find any file named test and remove it, by trawling the
> filesystem:
> 
> $ find / -name test | xargs rm
> 
> If the file you want to find has spaces or other odd characters in it,
> you may need to use:
> 
> $ find / -name test -print0 | xargs -0 rm
> 
> You could also use locate instead of find, which would save traversing
> the filesystem, but wouldn't catch files created since the locate db
> was updated last.
> 
> -- 
> Todd        OpenPGP -> KeyID: 0xBEAF0CE3 | URL: www.pobox.com/~tmz/pgp
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Damn you and your estrogenical treachery!
>     -- Stewie Griffin
> 



> -- 
> fedora-list mailing list
> fedora-list at redhat.com
> To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list

-- 
---- Fred Smith -- fredex at fcshome.stoneham.ma.us -----------------------------
                    The Lord detests the way of the wicked 
                  but he loves those who pursue righteousness.
----------------------------- Proverbs 15:9 (niv) -----------------------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/fedora-list/attachments/20071006/05e3763a/attachment-0001.sig>


More information about the fedora-list mailing list