4

I'm looking for something that will allow the content of one file to be mirrored to another file on the same system and partition.

For example, when the content of a file, say, originaltext.txt, was changed, the new content of originaltext.txt would also be present in another file, say, copytext.txt.

I've tried searching for what i have described in the title but all the results i got was of backup programs and software for mirroring across different systems or hard drives.

If anyone has knowledge regarding anything that will allow for this kind of functionality, sharing it would be much appreciated.

Jonas
  • 43

2 Answers2

2

Create a junction point. It would be the exact same file, pointed to from multiple locations.

Execute (under an Administrative command prompt) mklink /H C:\path\to\new\link C:\path\to\old\link. This will link the two files together, in every way. One changes, the other changes, in real time.

The entire mklink command list is available via Technet.

Another method could be to create a symbolic link (symlink). This is a little more involved, but can be accomplished quickly once set up. Via this guide, you can execute (again, as administrator) junction -s c:\path\to\old c:\path\to\new. This will create a symbolic link, which is useful for essentially creating shortcuts to other files.

Canadian Luke
  • 24,640
0

This answer will not be truly real-time. In order to do that you will need software that can handle Windows events.

Create a scheduled task to run every x minutes (1 minute would be fine if file is small).

Use this as the command:

robocopy.exe c:\source\ C:\target\ originaltext.txt /mir

This will copy that single text file from c:\source to c:\target.

Robocopy also has an option to monitor source, /mon:x, but this simply keeps the application open in a command window.