Monday, February 21, 2005

Sysinternals Junction

I've been working on a better method to manage my images. My technique is still emerging but is described here. What I got to thinking about was that programs like gaim want to write their data, e.g. logs, to their own directory and that wouldn't be on my data drive. I poked around on gaim's website to see if I could point their log directory to another location. All I could find was a lot of Linux references to symlinks. I could guess what these were and that they would do what I needed but didn't know how to do that on Windows.

google can find ANYTHING. I kept running into comments about Microsoft's fsutil. I'm convinced that this will do what I needed but I'll be damned if I can figure it out.

The other reference I kept turning up was's Junction utility.

Here's their description:
Win2K's version of NTFS supports directory symbolic links, where a directory serves as a symbolic link to another directory on the computer. For example, if the directory D:\SYMLINK specified C:\WINNT\SYSTEM32 as its target, then an application accessing D:\SYMLINK\DRIVERS would in reality be accessing C:\WINNT\SYSTEM32\DRIVERS. Directory symbolic links are known as NTFS junctions in Win2K. Unfortunately, Win2K comes with no tools for creating junctions - you have to purchase the Win2K Resource Kit, which comes the linkd program for creating junctions. I therefore decided to write my own junction-creating tool: Junction. Junction not only allows you to create NTFS junctions, it allows you to see if files or directories are actually reparse points. Reparse points are the mechanism on which NTFS junctions are based, and they are used by Win2K's Remote Storage Service (RSS), as well as volume mount points.
It is only 16KB. Download it and put it in c:\windows\system32.

The command to redirect a folder is so simple.
junction "C:\Documents and Settings\Ben Moore\Application Data\.gaim\logs" "E:\gaim logs"
Simply, this will make anything that references "C:\Documents and Settings\Ben Moore\Application Data\.gaim\logs" end up in "E:\gaim logs".

I even made me a .bat file to execute this when I need it. That should only be when I build a system from scratch.

No comments: