Search code examples
windowsubuntucygwinsymlinkcp

How to properly copy symlink files


In order to deploy an application, I have to copy the files located in C:\cygwin\dev into my destination folder.

Here are the files in that folder, they are symlinks :

enter image description here

When I copy/paste the files from Windows explorer I have no issue :

enter image description here

But my problem is when I copy them from command line, they are always empty. I tried several ways to copy them, like :

cp -Prv * /cygdrive/c/dest/folder/
cp -RvL * /cygdrive/c/dest/folder/
cp -RPav * /cygdrive/c/dest/folder/
tar cvf - . | (cd /cygdrive/c/dest/folder/ && tar xvf -)

And with all of these commands, I get empty files : enter image description here

I would really need to copy these files by using command line. Do you know why I can't correctly copy these files ?

Thanks a lot for your help.


Solution

  • Just tried this using Git Bash and copying them using "cp -R" works fine. It might be because your CygWin is only 32 bit and GitBash is 64bit. Should note as those files look like device files they're always going to be symlinks even if you try to disassociate with -L.