1

I have some files that I need for multiple projects.
I need changes made to them to be applied in directories of each projects.
Copy pasting them all the time is unpractical and I could forget to do it sometimes. So I need a way around this.

Also is there a way to do this for folders as well?

Thomas Dickey
  • 8,632
  • 3
  • 22
  • 31
zoran404
  • 205
  • 1
  • 4
  • 11

3 Answers3

1

You can use simbolic links. Open cmd (Windows + R, then type "cmd", enter) and navigate to the directory where do you want to have your files (use cd for that). Then type mklink <link_name> <path_where_you_have_your_original_files>.

You can do this for directories too, but add the switch /D in the above command.

redbeam_
  • 537
  • 5
  • 16
1

You can indeed. mklink.exe is your friend here.

It sounds like you want to create hard links for your files in all of your projects, so you would start with one of the files and create hard links to the other directories. At this point, all of the file names will be pointing at the same chunk of data. You could create symlinks as well, but I think a hard link fits your model better.

mklink /h linkname targetpath

You can also use it to create directory links, which will behave slightly differently as there will be one real directory, and the links will point to it.

mklink /d linkname targetpath

Further details at What are the various link types in Windows? How do I create them?

dsolimano
  • 2,906
  • 2
  • 23
  • 37
  • This is odd, when I change either of the hard linked files and go to open the other I see that it's not updated. Why? – zoran404 May 20 '15 at 21:57
  • That doesn't seem possible . . . how odd. Can you post the output of a DIR in both directories? – dsolimano May 20 '15 at 21:58
  • Well DIR command says they have different 'last modified' times, different size and the same name (they are in different directories) – zoran404 May 20 '15 at 22:02
  • I doubt it has something to do with it not being on c partition. Maybe something to do with the way I did it? (you can see my answer to this question of how exactly I did it) – zoran404 May 20 '15 at 22:05
  • well at least junctions work. Although Unity says it's asymbolic link, probably because the folders are on same partition. – zoran404 May 20 '15 at 22:31
  • @zoran404, Just tried this and it worked . . . did the file already exist in the second directory? I did what you have in your answer and I see a hardlink. – dsolimano May 21 '15 at 00:22
0

I up-voted your answers but I just want to add some tips I found for whoever visits this question:

First go to the folder where you want to create the link, then press Shift + Right Mouse button in the folder (this opens the extended menu) and select "Open command window here"

In command window type:

mklink /h newLinkName pathToOriginal

Similar goes for directories:

mklink /d newLinkName pathToOriginal

Btw instead of typing the path to the original file you can just drag and drop it into the console.

zoran404
  • 205
  • 1
  • 4
  • 11