Re: Directory name problem...

Cameron Simpson (cs@zip.com.au)
Mon, 26 Oct 1998 18:17:29 +1100 (EST)


On 26 Oct 1998, in message <Pine.BSF.4.05.9810252046220.1986-100000@earl-grey.cloud9.net>
John Alvord <jalvo@cloud9.net> wrote:
| > > 0 6 * * * find / -name core -exec rm {} ';'
| > I think you may find:
| > find / -type f -name core -exec rm {} ';'
| >
| > to do exactly what you want.
| > The -type f tells it to only look at files and as such you wont
| > be relying on error reporting from rm.
|
| Another advantage of using -type f will be seen if someone creates a
| symlink from the "core" file to a critical system file. -type f means a
| "real file" and symlinks are excluded as well as directories and /dev
| files.

While your caution is prudent, rm on a symlink blows away only the symlink,
not what it points to.

Of course, the -type f stuff is good for things like this:
find / -type f -name core -exec do-some-editing-on {} ';'
which would, of course, follow the symlink and mangle the target...

--
Cameron Simpson, DoD#743        cs@zip.com.au        http://www.zip.com.au/~cs/

The trouble with fighting for human freedom is that one spends most of one's time defending scoundrels. For it is against scoundrels that oppressive laws are first aimed, and oppression must be stopped at the beginning if it is to be stopped at all. - H.L. Mencken

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/