Native symbolic link behavior is broken and makes backups using Cygwin command line tools impossible

Eliot Moss moss@cs.umass.edu
Mon Jan 4 12:30:03 GMT 2021


On 1/4/2021 5:36 AM, Matt D. via Cygwin wrote:
 > Did you try any of my test cases? This can't and doesn't work for the
 > reasons I outlined in my previous message:
 >
 > $ cp -av folder_a/a folder_b/
 > 'folder_a/a' -> 'folder_b/a'
 > cp: cannot create symbolic link 'folder_b/a': No such file or directory
 >
 > $ cp -dv folder_a/a folder_b/
 > 'folder_a/a' -> 'folder_b/a'
 > cp: cannot create symbolic link 'folder_b/a': No such file or directory
 >
 > $ cp -Pv folder_a/a folder_b/
 > 'folder_a/a' -> 'folder_b/a'
 > cp: cannot create symbolic link 'folder_b/a': No such file or directory

So did you mkdir folder_b first?  I don't think cp will create it for you.  I
tried the commands above with folder_b not existing and got the behavior you
indicated, but when I created folder_b first, all three cp commands worked.
This overall behavior does not surprise me.

On the other hand, if I have folder_b non-existing and do (e.g.)

cp -rav folder_a folder_b

then it _does_ create folder_b, and also copies the links.

HTH - Eliot Moss


More information about the Cygwin mailing list