4

Updated:

I want to do something, but I don't know how and I suspect that it isn't possible. I'm on Windows 10.

Imagine that I have a directory c:\originalDirectory and I create a link at c:\newDirectory by doing mklink /d c:\newDirectory c:\originalDirectory.

My question is about the files that live inside a linked directory. When I delete c:\newDirectory\exampleFile.jpg, the original file is also deleted at c:\originalDirectory\exampleFile.jpg. Of course, the link itself c:\newDirectory is not removed.

Doing a directory junction with mklink /j c:\newDirectory c:\originalDirectory results in the same behavior.

Is there some form of link or file synchronization mechanism wherein if I delete c:\newDirectory\exampleFile.jpg, the original file at c:\originalDirectory\exampleFile.jpg is preserved? Of course, I would also want to preserve the link itself at c:\newDirectory.

I recognize that if I create a links to the individual files themselves by doing mklink c:\newDirectory\linkToExampleFile.jpg c:\originalDirectory\exampleFile.jpg, I can delete c:\newDirectory\linkToExampleFile.jpg without deleting c:\originalDirectory\exampleFile.jpg. But there are A LOT of files in c:\originalDirectory so creating a link to each file doesn't seem like a great option.

2
  • 1
    I don't know who keeps downvoting here, but I'm out of this post.
    – harrymc
    Aug 6 '20 at 9:38
  • 1
    @harrymc I don't see any aggressive behaviour here. T.J.L is patiently trying to help you write better answers. You would do well to pay heed to their advice.
    – Burgi
    Aug 6 '20 at 13:57
1

The best that I've come up with is to use Microsoft SyncToy to synchronize the folders while preventing any deletions in the right folder, c:\newDirectory, from deleting files in the left folder, c:\originalDirectory. However, this solution uses twice the amount of disc space because the files live in both folders.

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.