0

I want to sync a large folder on my Windows machine to OneDrive without duplicating it on my local drive. I have read two tutorials suggesting using the mklink command to create a link between the folder and the OneDrive sync folder, but they use different options: /D and /J.

The first tutorial recommends using the /J option to create a directory junction, which is a type of symbolic link that can link directories across different volumes. The second tutorial (from the official Microsoft website) recommends using the /D option to create a directory symbolic link, which is another type of symbolic link that can also link directories across different volumes.

I am confused about the difference between these two options and which one I should use for my purpose. I have read some articles that explain the difference between hard links and symbolic links, but I am still unclear about the difference between directory junctions and directory symbolic links and how they affect the OneDrive sync process.

Can anyone explain the difference between the /D and /J options for the mklink command and which one is better for syncing folders to OneDrive? Thank you in advance.

3
  • Dear @Mokubai, I do not appreciate your closing my post without reading it thoroughly. None of the links you mentioned say anything about OneDrive, which is the core of my question. I want to know which of of these options, /D and /J, is the right option for my application. I understand that you want to do good, but rushing into closing posts doesn't help anyone. I would appreciate it if you could open my question.
    – Foad
    Jan 17 at 11:14
  • What have you tried? Have you tested both methods? In theory Onedrive should handle them the same, but it would be trivial to create a couple of small test folders on your system and then link them in in both ways to test out behaviours.
    – Mokubai
    Jan 17 at 12:31

1 Answer 1

0

Since you're creating the links in Windows, the difference is explained in the posts listed in the comment by @Mokubai.

As regrading OneDrive, there is a red flag raised by the following sources:

It seems like the OneDrive sync may sometimes have issues with both kinds of links. Microsoft counsels to move these folders physically into the OneDrive folder, and replace them by links to the moved folders.

In general I would conclude that both links may work for OneDrive (I would think for most of the cases), but you should check from time to time that they continue to work correctly, especially after Windows Updates to OneDrive.

4
  • So, to be sure I understand you correctly, you are saying as far as OneDrive is concerned, there is no difference between the two options. Right?
    – Foad
    Jan 18 at 14:11
  • OneDrive may have difficulties with links that are located inside its folder. It may work in some cases but not in others. My answer says that when it doesn't work, moving the linked objects into the OneDrive folder is one (awkward) solution.
    – harrymc
    Jan 18 at 14:16
  • I am aware of the risks, but that's not my question. Both links you have provided in your answer are already mentioned in the original post above. The question is, are there differences as far as OneDrive sees the different symbolically linked directories?
    – Foad
    Jan 18 at 14:29
  • No, there are no differences, since it uses Windows API that should work the same as for any other Windows programs. OneDrive may have additional checks on the properties of the files/folders that may cause it to misbehave, which is probably a bug. Even if it works for you, I suggest to re-verify that it's still working after any Windows update. I don't use OneDrive because of all these idiosyncrasies that may hit without warning.
    – harrymc
    Jan 18 at 14:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .