10

I made some symlinks in MS Windows using mklink /D command. But when copy it, Windows Explorer always perform deep copy instead copying symlink itself. How can I just copy the link? I need to send these links to other users on other machine.

Basj
  • 2,143
Eonil
  • 6,094

5 Answers5

6

partially duplicate question, multiple good answers are here

Using Windows tool

xcopy /b /i <source symlink name> <destination symlink name>

and you should disregard a message:

output is 0 File(s) copied

also another tool in standard Windows installation: robocopy

/SL :: copy symbolic links versus the target.

Since you mentioned you want to "send" it, you might get TAR which can pack/unpack symlinks into one archive file. 7z might one day too.
As I see it, 7zip can archive them but not extract on Windows.

papo
  • 516
5

A tool answer: LinkShellExtension allows you to do this and much more. If you're working with soft/hard links in Windows at all, it's an enormously helpful tool.

In this case, you probably want to choose its 'Splice' behaviour in copying Symlinks.

Sundar R
  • 1,539
2

The symlink to a directory acts as a directory itself. So, when you copy the symbolic link, you copy the directory.

If you had a directory with a bunch of files in it and you wanted a copy of it, but without the files in it, you'd just make a new directory with the same name. Same thing applies here, really.

Alex
  • 250
Jack
  • 1,343
-1

The answer is as simple as that: You cannot. Instead, run the same command on the other machine.

-2

Just drag and drop the symlinks between one explorer window to their destination in another. It will move them without copy the contents.

xxx
  • 1