
So let’s imagine we have a "c:\1.txt" text file,
and a folder "c:\other\" that contains 3 other text files (A, B, C).
What I want to do is, redirect c:\1.txt to A, B, or C randomly, or according to a specific time of day.
For example, if you open the 1.txt file, with any application (notepad, wordpad, whatever).. Windows should act like it’s talking to "c:\other\A.txt" for readings, writings, etc.. instead of c:\1.txt. As if Windows is lying to all other applications and acting like the file changed, when it’s actually just redirecting to an other file, and not changing the real one.
Windows 7 already does something like this with the ‘program files’ folder I think, but I need to be able to switch files (between A, B, C) using Windows API or something, with Java, or any other common programming langage. I need to tell Windows what file to choose each time.
Has anyone ever heard of something like this before? Is it possible? How?
You can do this with a symbolic link. At the command line you would do it like this:
Programmatically you use the
CreateSymbolicLinkfunction.But you cannot do that and keep a true file named C:\1.txt. You cannot have two distinct objects with the same name.
Regarding the Program Files and Program Files (x86) folders, they are just ordinary folders. It’s only convention that says that 64 bit apps go in the former, and 32 bit apps go in the latter. Perhaps you are thinking of the file system redirector which affects the system32 folder. Anyway, that’s really outwith the question.