bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

cp -rfL and symlinks to directories


From: Martin Michlmayr
Subject: cp -rfL and symlinks to directories
Date: Wed, 25 Jan 2006 17:31:54 +0000
User-agent: Mutt/1.5.11

I wonder if cp -rfL could handle symlinks to directories better than
it currently does.

Let's consider the following case:

$ mkdir -p a/b
$ ln -s b a/a
$ ls -l a
total 4
lrwxrwxrwx 1 tbm tbm    1 2006-01-25 17:26 a -> b
drwxr-xr-x 2 tbm tbm 4096 2006-01-25 17:26 b
$ cp -rfL a b
cp: will not create hard link `b/a' to directory `b/b'

The reason is that it tries to reference symlinks by making hard links
and when it encounters a symlink to a directory it barfs because
you're not allowed to make a hard link in this case.  What I'm
wondering whether it would be possible for cp to recognize this case
and then recurse into this directory and hard link every file in it?

Alternatively, is there any way I can tell cp to dereference any
symlinks pointing outside the tree I'm copying (so I don't end up with
broken links when I copy this to another machine) and simply use
symlinks for the rest?
-- 
Martin Michlmayr
http://www.cyrius.com/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]