Copying symlinks to another win10 PC with another drive-letter and folder structure

delaflota

Well-Known Member
Hi,
I'm using two win10 PCs (a Pro and a Home).
I just built some symlinks in different folders to a target folder mp4 files.
Now I have some time to copy these symlinks to my Notebook without having to build all of the symlinks again.
That means that the target, which is visible on any of the symlink files (in Properties) should remain as is but being able to access the target files (in the Notebook).
As a simplified example, say the symlinks are in "D:\music\scales\songs according to scales\examples" and the target folder is "D:\music\scales\songs according to scales\target".
Now the Notebook drive letter is F: but I have a recovery drive with the letter D: too.
So my target files should now go to the driver letter F: because of the sufficient space.

Now I built the structure F:\music\scales\songs according to scales\examples (where the symlinks should be copied in) and on the D: drive I created the structure
D:\music\scales\songs according to scales\target which should get a symlinked folder showing to the real folder in F:\music\scales\songs according to scales\target (where the real files should be copied in).

So I changed then to F:\music\scales\songs according to scales\examples and set up the command:

mklink /D "D:\music\scales\songs according to scales\target" "F:\music\scales\songs according to scales\target"

But the answer is:
"A file can't be created when it already exists"

Or even more simplified:
On PC:
cd D:\symlinks
mklink file1.mp4 D:\target\file1.mp4

Now on my Notebook :
cd F:\symlinks
mklink /D D:\target F:\target

My thinking was:
If I now access a symlink file in F:\symlinks it should access the target file in F:\target over the symlink "D:\target"

Any ideas?

Thanks
 


Last edited:

Neemobeer

Windows Forum Team
Staff member
Well a straight right click copy would copy the target directory/file and not the symlink. You can try xcopy with the /B argument, but I can't say I've ever tried to copy them and if I had to guess I'd say it would not be possible.

A Symlink both hard and soft point to a MFT entry and even if they point to the same location or file (by name) that does not mean the MFT entries will match up and likely will not work.

If the directory names and structure is the same I'd just say the commands in a batch file and run that on the other computer.
 


delaflota

Well-Known Member
Thanks @Neemobeer!

I just managed it to work properly now. So the problem seems solved for now!

BUT IT'S NOT REALLY SOLVED!!! SEE BELOW!

The wrong doing was to give the whole directory path as a symlink in:

mklink /D "D:\music\scales\songs according to scales\target" "F:\music\scales\songs according to scales\target"

The trick is rather to change to "D:\music\scales\songs according to scales" first (in the command window) and then

mklink /D target "F:\music\scales\songs according to scales\target"

So you create the directory link (last folder) in the second last folder which leads you then to the real destination folder where the real files have been copied to.

And copying the symlinks works fine with "xcopy /b "source-folder/*" "destination-folder", just as you said too:)

- - - - - - - -

CORRECTION:

I just realized that whenever I copy a "real" file to the target folder "F:\music\scales\songs according to scales\target"
it's been also copied into the symlink folder "D:\music\scales\songs according to scales\target" (means the real file with the same size)...
This wasn't what I actually wanted....

I'm not sure yet what that all means. At least it seems not to affect the used space of the D: drive, even after I copied about 150 MB of data to the real file folder in F:.
Quite strange!
 


Last edited:
This website is not affiliated, owned, or endorsed by Microsoft Corporation. It is a member of the Microsoft Partner Program.
Top