27

Is it possible to copy a Symlink to a directory in Windows 7. When I try to copy a symlink'd directory, it tries to deep copy the contents to the location.

24

I don't know of a way to do it within Windows Explorer, but you can use xcopy at the command line with the /b argument, see here.

| improve this answer | |
  • 1
    @Neal Worked for me like a charm. I have added /i as well. Make sure you are working with folder SYMLINKS (not junctions). – Anton Krouglov Mar 9 '17 at 15:31
13

use the following command in the elevated command prompt:

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

The output is 0 File(s) copied nevertheless the symlink is created in the destination. This is tested under Windows 7 and Windows 8.x but should work starting as of Vista

UPDATE: it works in Windows 10 as well

| improve this answer | |
  • 1
    doesn't work for me, it still does a physical copy, not copying a symlink... – jakub.g Aug 4 '16 at 15:55
  • 1
    Worked for me: Win 10 x64, elevated prompt. Tested on win 2012 R2 as well. MAKE SURE YOU DO NOT MIX JUNCTIONS WITH SYMLINKS. – Anton Krouglov Mar 9 '17 at 15:34
  • Not working on Windows 10.2004. Elevated prompt. 0 files copied and that's what it did. – ygoe Aug 13 at 18:24
10

Use a program that supports them, obviously. Far Manager for example allows me to either copy symlinks as links or traverse them and copy their contents:

alt text

| improve this answer | |
  • Correction, it does work for local symlinked folders only. For network ones only xcopy /b /i helps. – Anton Krouglov Mar 9 '17 at 15:45
2

Far Manager was the only thing that worked. Thanks Joey.

For some reason Link Shell Extension either doesn't provide a way to copy sym links/junctions, or I'm too stupid to figure it out. Tried everything on the Drop As... menu.

With Far Manager, just hit Copy at the bottom of the interface, after making sure that the other window pane is pointed at your destination folder. It's that simple!

I copied my entire User folder! Some links you have to correct afterwards, like application data. If you have Link Shell Extension just right click and change the path in the Link context properties menu. Otherwise they will point to your old drive. Be sure to correct the ones inside application data, AppData\Local, and Temporary Internet Files too. Be sure to TAKE OWNERSHIP before copying!

Also, you need to do this logged in to another Admin profile, or booted into another OS. If you're booted into another OS make sure the links point to the drive letter that the target OS wants, not the drive letter the current OS wants. For example my target OS is J:\users\Me. My Junctions there point to C:\users\Me because C:\ is the drive letter I'll be booted into. (Yes, clicking the links now will open your current OS's folder. Don't worry about it.)

There are Registry entries you have to change. See here.

| improve this answer | |
  • Link Shell Extension works, however the instructions are a bit convoluted for copying already existing symlinked-folders: superuser.com/a/1509670/231129 (Link Shell Extension is still worth getting, in my opinion, for the streamlined creation of sym-links, however.) – Venryx Dec 13 '19 at 1:33
1

Also I found a shell extension that might make this a bit simpler.

It's demonstrated on HowToGeek here

And the link to the shell extension itself is here

Unfortunately I haven't had a chance to test this myself because I need to do it on a server and I don't particularly want to fiddle around with shell extension on a production server - but I thought it might be useful.

| improve this answer | |
1

This was done using Windows 10 Pro edition. However, I think it is the same on Windows 7 and Windows 8.

First, add the ability to create symlinks to your non-admin user account. This is found in the Local Security Policy (secpol) in "Security Settings>LocalPolicies>User Rights Assignment>Create symbolic links". By adding your non-admin user to this user rights setting, you are allowed to create symbolic links, a permission you need if you copy, and therefore create, a symlink.

Then do this in a command prompt window:

copy /L sourceLocation targetLocation
| improve this answer | |
  • I don't see a /l in the copy reference referring to win2008r2 and win2012r2. – ivan_pozdeev Mar 9 '17 at 1:04
  • See if "help copy" in the command prompt lists the /L option. I'm not sure if the server versions of Windows provide the same options as windows 10 and 8, though one could expect it to. – eug- Mar 18 '17 at 7:40
1

You can use Link Shell Extension for this, however the instructions are a bit convoluted. (for copying already-existing symbolic-links)

Instructions

  1. Use its LSEConfig.exe utility to change the "Outer Junction/Symbolic Link" setting to "Splice".
  2. Right-click and "Pick Link Source" the parent folder of the sym-linked folder you want to copy.
  3. Go to the parent folder of the place you want to drop the sym-linked folder, and run "Drop As: Smart Copy".
  4. Rename the temporary parent "container folder" to the destination/real parent-folder name.

The procedure is somewhat of a hassle, so I'd recommend using xcopy or Far Manager instead. (haven't tried them yet, but I'm assuming they're more straight-forward for direct/single sym-linked-folder copying)

(Link Shell Extension is still worth getting, in my opinion, for the streamlined creation of sym-links, however.)

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.