Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

In Windows 7, I have three folders: "Images", "assets" and "all".

I want the contents of "Images " and "assets" to appear in "all" automatically without copying those files into that folder (e.g. I don't want to duplicate the files). I also only want the contents to be copied over and not the folders themslves (The reason for this is that if the folders are copied over, they will become sub-directories. I am using a printing hot folder that access "all" but it can't see any subdirectories in "all").

When Images and Assets are updated (e.g. with files being added or deleted), "all" should automatically update as well.

How can I do this?

This is what I have tried:

Libraries: This is a feature built into Windows. It works exactly as I want. However, the print hot folder cannot recognise the library as a folder.

Sym Link Extension: I can use this to make the "images" and "assets" folders appear as a sub directories of "all". However, I want the contents of "images"/"assets" to appear in the "all" folder (I don't want the directories to appear as sub directories, because as stated, the print hot folder cannot access sub directories).

share|improve this question
    
Can your "printing hot folder" access two or more folders? Then just point it to access both images and assets. Granted, this isn't what you want, but I don't think you can easily auto-symlink merge two folders into one without running into problems. How will you manage conflicts? –  ADTC Nov 10 '13 at 18:18
    
No it can only access one folder. –  big_smile Nov 10 '13 at 18:43
add comment

2 Answers

This can't be easily done with the tools available in Windows.

Libraries are not regular folders but are virtual folders. Not many applications can use Windows Shell objects directly which are not file system objects.

So a script which creates hard links in "all" for all the files in "Assets" and "Images" seems to be the easiest way.

cd all
rem Remove all the files in all
del /f /q *.*

rem Create hard links to files from assets and images
for %I in (<full-path-to>\assets\*.*) do mklink /h "%~nxI" "%I"
for %I in (<full-path-to>\images\*.*) do mklink /h "%~nxI" "%I"

Here %~nxI will expand to file name and extension only, without the path. If the folders are on different drives, you have to use symbolic links: remove /h switch from mklink command.

Run the script above every time the contents of "Assets" and/or "Images" is updated, or run it periodically.

A better solution would watch for file updates in "Assets" and "Images" and synchronize the changes to "all".

share|improve this answer
add comment

The only way I know for sure is to make a script that creates hard links in "All" to every file from "Assets" and "Images".

But I think that this method is quite an overkill for such a simple task.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.