# Recursive `rm'; what is its symlink policy? [SOLVED]

## gentsquash

This may be implicit in (man "rm"); I don't see it explicitly.

Does `rm' simply NOT follow symlinks?  (I did some testing, and

this seems to be the case.)  Or does it have some

more-complicated rule which looks at the symlink-target?

[Aside: Is the following to be considered a Bug?: Although

(man "cp") is detailed on how it handles symlinks in

recursive-copies, the `scp' man-page is taciturn in the

extreme...

I sure wish that `scp' had the same recursive-copy options

that `cp' has.]

----------

## adaptr

No, rm does not follow symlinks; it should not, as a symlink is a "jump" from one location in the filesystem to another.

Rm just deletes the direct contents of directories - for a symlinked directory, that is the symlink itself.

More technically, it recursively removes all inodes and their dependants; since the inodes for a symlinked directory are not referenced by the symlink itself (they are referenced by the inode the symlink points to), they are not removed.

----------

## gentsquash

Thank you adaptr.

What is Linus's telephone number, so I can get him moving on this

`scp' improvement...  ?

----------

## adaptr

Linus Torvalds has nothing to do with scp - or with the 2.6 kernel, for that matter.

How about you try to improve it yourself ?

It is not called open source for nothing...

----------

## gentsquash

Agreed on the Open Source.  Any little contributions I have made

have been on easier stuff; emacs-lisp code for simple functions.

----------

