4

I created a docx file in windows 7 with some text in it (initial.docx) and then I created a hardlink to it:

mklink /H new.docx initial.docx

I open new.docx and I can see the text that I initially typed in initial.docx. Now I type some more text in new.docx. Here comes the problem: I save it and at this point initial.docx becomes hidden in the windows-explorer. I open initial.docx and I can see that it does not contain the new text that I saved in new.docx.

If instead of modifying new.docx after creating it I modify the original file and save it, then new.docx gets hiddenn and does not contain the modifications.

Any one knows a workaround ?

Note that if I do the same with text files, I don't get this problem: the files are effectively linked and every change in one of them is visible in the other one.

Ben2209
  • 153
  • 4

1 Answers1

3

There may be no way to fix this. I suspect this is a by-product of how the save process works in some programs.

Instead of simply writing over the top of your existing file, they will save to a new temporary file, then rename things a bit, and finally delete the original. This gives you some additional safety. If your computer crashes while your save is happening, the original should still exist, and you will likely have the new version available as a temp file, so theoretically, you lose nothing. For programs that simply over-write the file, if a failure happens during a save, then you may lose everything.

I suspect that during the save/rename operation your link is being removed. I don't believe there is anything you can do about this. You see the same behavior with ACLs set explicitly on files.

I have seen many programs that use this type of saving procedure, this isn't just MS Office.

Zoredache
  • 128,755
  • 40
  • 271
  • 413
  • Thanks for your reply. Yes that was my fear. Too bad, I wanted to edit documents and have them in the dropbox without losing the original path structures but I'll have to live with it! – Ben2209 Feb 23 '12 at 09:41
  • It is [still possible to have a symlink to a file](http://answers.microsoft.com/en-us/office/forum/office_2007-word/hard-links-created-in-windows-not-updated-after/659de19b-596b-49b6-b83b-cbfe15c4c27f). You'd have to keep the original in Dropbox though. – mlt Feb 21 '15 at 07:52
  • My limited-use workaround is to convert the subject Word file to a Wordpad file (using the "rtf" file id). This works only for relatively simple files, of course. – Digger Jul 08 '16 at 04:16