0

Say I have a file: C:\private\book-list.txt

And it needs to be echo-ed automatically after a change is made to

C:\dropbox\book-list.txt
C:\box\book-list.txt

In order to my friends to be able to read it.

Please help me do this on Windows 7 platform.

1
  • Please edit your post to clarify what you want to accomplish. I can't make heads or tails of this as it is currently written. Are all 3 text files the same, and do you want to link them, or are they different?
    – LPChip
    Sep 13, 2015 at 11:27

1 Answer 1

1

In order to copy this file you can fire up a shell and issue this command:

copy C:\dropbox\book-list.txt C:\box\book-list.txt

You can either do that every single time that the file changes (and possibly try to automate that, or you can use do this:

mklink /H C:\dropbox\book-list.txt C:\box\book-list.txt

This does not copy the file contents, but creates a second directory entry. You can now open the same file by two different names. And one of those is in your dropbox folder.

If you change C:\dropbox\book-list.txt then the changes are written to the file on disk. If you open it from C:\box\book-list.txt you will see the same changed file.

Some more information about links:

The syntax:

MKLINK [[/D] | [/H] | [/J]] Link Target

    /D      Creates a directory symbolic link.  Default is a file
            symbolic link.
    /H      Creates a hard link instead of a symbolic link.
    /J      Creates a Directory Junction.
    Link    specifies the new symbolic link name.
    Target  specifies the path (relative or absolute) that the new link refers to.

Links:

Technet on mklink
a question on serverfault

Deleting:

To delete it simply delete both copies. Only deleting the last copy will free the diskspace used.

3
  • I suggest using a hard link instead of a symlink, as long as the files are all on the same volume. By default, you need to be Administrator to create a symlink on Windows. Hardlinks can be created to any file you can edit.
    – CBHacking
    Sep 13, 2015 at 12:34
  • This may not apply to using mklink /h, but note that for junction points and aliases Dropbox requires the original file to be in the Dropbox folder (so, the opposite of what is described in the answer above). When the original is not in the Dropbox folder, then "any changes to those files or folders made from the Windows operating system will not sync again until the Dropbox desktop application is restarted". I don't know if the same applies to Box.
    – Arjan
    Sep 13, 2015 at 14:29
  • You are correct. Being on the same filesystem (in this case volume C:) made me automatically assumed hardlinks. For windows this indeed is not the default. Will fix.
    – Hennes
    Sep 13, 2015 at 15:33

You must log in to answer this question.

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