Ruby on Rails
SymLinks

A symbolic link (“\SymLink”, also known as a "shortcut") links different parts of a file system, by making it appear that a file or directory in one location is also in another.

Cross-platform solution.

Untested on Windows, but I think this command
run unnder IRB will create a symlink.

File.symlink(“testfile”, "link2test")

This is actually unsupported in Windows. As far as I know, there is no existing Ruby library that supports NTFS junctions.

[ Would someone please put a Ruby expression

here that creates a symlink for any platform.
I hate having to remember both “unix-style” and
“windows-style” versions of such commands, and
think the biggest strength of a cross-platform
scripting language like ruby is so I don’t need
to know the trivia listed below. I suspect it’s
a one-liner using IRB and the Pathname library,
but I don’t know it.]

UNIX-style operating systems (including linux, OSX, etc.)

Under UNIX-style operating systems, a \SymLink may be created by typing:

ln -s path/to/real/file/or/directory  path/to/where/you/want/the/link

This works equally well for files and directories.

h2. Microsoft Windows

Under Microsoft Windows symbolic links to files are called shortcuts and they can be created by right-clicking on the file, choosing “Copy Shortcut” and then pasting the shortcut where you want it.

Under Microsoft Windows you can also create symbolic directory links but they are called junctions. However, there is no built-in way to create them. Here are 2 utilities that allow you to create them but I’m sure more exist:

Category: Glossary