Quick scripting question
Todd Zullinger
tmz at pobox.com
Sat Oct 6 17:52:55 UTC 2007
Chris wrote:
> How would I script removing a file (globally) ?
Very carefully. :)
> 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 542 bytes
Desc: not available
Url : http://lists.fedoraproject.org/pipermail/users/attachments/20071006/cd8cdd87/attachment-0001.bin
More information about the users
mailing list