2

I have a folder located at E:\My Work\code_library which I plan to store code snippets, etc..

I have a folder located at E:\Server\htdocs\code_library which is my Apache root directory

Is there a way that I can edit files at either location and have them replicate/stay in sync/ or BE the same files?

For organizational purposes, I would like to keep files located at E:\My Work\code_library this folder has a large amount of other folders, all work related, it is easy to copy/transport/keep on a thumb drive/etc... these files as they are all located in a convenient location TOGETHER

I then have to keep files at E:\Server\htdocs\code_library as well so I can access them in my web browser and have PHP and stuff work.

Any ideas?

2 Answers 2

4

Assuming you are comfortable with the command line, you can make a symbolic link in htdocs that points to E:\My Work\code_library.

Remove/rename the code_library directory in E:\Server\htdocs. Then open a command prompt, and CD to E:\Server\htdocs. Then make your symbolic link:

mklink /d code_library "E:\My Work\code_library"

I should mention that you can do this the other way. That is, leave the Apache folder code_library in place, and make E:\My Work\code_library a symbolic link that points to the Apache copy.

5
  • This looks like it could be a good solution, Ill research it more, thank you
    – JasonDavis
    Nov 4, 2011 at 0:47
  • I actually do this with my Visual Studio project folder. Not with Apache, but because I like having it in a root folder called Work. Visual Studio likes me to have a folder called Projects in My Documents. So a make a Projects symlink that points to \Work. Nov 4, 2011 at 0:56
  • Awesome, I wasn't aware of this feature. Lately I have really been organizing things to optimize my work-flow in future projects and this looks like a really useful thing for multiple things. I am curious, do you know if there is a way to save this to some sort of file that can be ran. For example, if I format my drives or got a new PC, would be nice to be able to double click a file to restore symlinks?
    – JasonDavis
    Nov 4, 2011 at 1:07
  • symlinks are part of the filesystem. You don't need to "save" them, they're already on the drive. Now, if you're talking about symlinks across drive boundaries, then you'd need a backup utility that's aware of them.
    – afrazier
    Nov 4, 2011 at 2:54
  • I agree with afrazier. You could also save the mklink command line above to a batch file, and run that if you completely rebuild the system. Nov 4, 2011 at 11:29
0

I answered a similar question in this SU post. If you are ok with manually triggering the sync operation, SyncToy, a free PowerToy utility from Microsoft, may provide the functionality that you're looking for. From Wikipedia, operations include:

  • Synchronize takes the two folders and makes sure they have exactly the same files. To do this, SyncToy may copy files in either direction and may delete or rename files in either folder. In the case that a file has been updated in both the left and right folders, the version with the later modification date is considered the conflict winner and will overwrite the other version.3
  • Echo looks for changes (file modifications, new files, renames, deletes) in the left folder and makes them in the right folder (one-way sync).
  • Contribute is like an Echo, but it does not delete any files on the right folder that may have been deleted in the left folder.

You must log in to answer this question.

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