Copying of symbolic links not working as expected

Eliot Moss moss@cs.umass.edu
Sun Apr 21 12:20:00 GMT 2019


On 4/21/2019 7:45 AM, Matt D. wrote:
> Note that this creates a chicken-and-the-egg problem when copying paths which contain symbolic links 
> which will be but are not yet valid at the time of copying.
> 
> For example, copying a very large and complex tree with many lots of links will result in a broken 
> copy. I'm trying to copy a directory tree right now and it's a major headache.

Dear Matt - My reading of the cp man page suggests that the
-d flag addresses this issue for cp.

Now tar has these flags available:

-h (--dereference) to follow sym links, and
--hard-dereference to follow hard links

This suggests that tar does not normally follow links.  So I am
less certain what is happening there.

Another program you might consider is rsync.  While I normally
think of it as being for efficient cross-network copying, it
works within a system as well.  It will pay to read through about
its flags before trying to use it for this purpose.

It is true that, compared with Linux, Cygwin symlinks are slightly
funky in that they are true files in the Windows file system, but
with a specific format that Cygwin recognizes as special but Windows
does not.  But that should not generally be noticeable when using
generic Cygwin versions of programs such as these.

Regards - Eliot Moss

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple



More information about the Cygwin mailing list