3

I'd like to synchronise some configuration files via a file hoster like Dropbox. I could create a hard link in the software's configuration folder and let it point to my cloud storage directory.

When having done that, is there a difference between those two files? I read somewhere that both files are attributes of the file in the master file table and that there would be no difference at all.

On the other hand, on Windows, directory junctions via mklink can be found using dir /AL /S, so they somehow differ from real directories.

Is that correct?

  • Are you referring to a symbolic link or the actual hard link? – Raystafarian Apr 11 '14 at 19:03
  • mklink's help says that it creates a hard link to a file using mklink /H. So I am referring to a hard link. I suppose the directory junction is a symbolic link? However, I can use directory junctions just as normal directories, but I cannot use symbolic file links as files as those programs using it complain that they cannot find the file. So I thought those directory junctions would be hard links as well. – Xiphias Apr 11 '14 at 19:13
  • 1
    just to add to accepted answer you can hardlink files, but not directories. On the other hand (AFAIR) Dropbox properly handle junctions so you could link folders with mklink /j – wmz Apr 11 '14 at 19:40
3

No they dont differ. A Hard link is created via mklink /H. Notice the /H switch.

I read somewhere that both files are attributes of the file in the master file table and that there would be no difference at all.

Correct.

If you ommit the /H switch, you create a junction or soft link

A junction (also called a soft link) differs from a hard link in that the storage objects it references are separate directories, and a junction can link directories located on different local volumes on the same computer. Otherwise, junctions operate identically to hard links.

via msdm

The difference between a junction and a hard link is:

  • hard links must be on the same partition. If you delete the last hard link, the file is deletet.

  • junctions can be on different volumes

  • 2
    Do be aware, however, that some synchronization software (e.g. rsync can do this) will "break" your hard links, where the "updated" file is actually a new one, but your hard link elsewhere still in effect is the old file. I don't know offhand if Dropbox does this, so test that, but if it does you can link to a directory inside your Dropbox folder instead, and that will work fine (I use this method myself, so I know it works). – Kromey Apr 11 '14 at 19:53

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.