I have a lot of my CDs ripped onto my Windows XP computer, but they won’t all fit on one drive. I have another drive, but they won’t all fit on that drive either. Despite this, I want all my music in one directory-- or at least linked to from one directory. How can I do this without the incredibly tedious process of making shortcuts for every music album directory on one drive and then renaming them to exclude the “shortcut to…”, and then copying them over the music folder on the other drive?
in other words, is there a way that I can access all my music files easily from one directory, even if they are scattered over multiple drives?
(by the way, I should state here that I’m not really looking for any music-specific applications or programs to aid me in this process… I’m looking for some way within XP)
There is no short way that I know of. The easiest way is to select all the directories (albums) on each drive, and right-mouse-button drag them to your target directory. As you drop them, click “Create Shortcut” on the resulting popup menu. Assuming that they’re all in one place on each drive, you only have as many steps to perform as you have drives with music on them.
If they’re not all in the one place on each drive, now’s the time to fix that.
If you can live with the “Shortcut to…” prefix (sounds like you can’t), that’s all you need to do.
If you’ve got whole drives full of music, it may help to know that existing drives (or partitions) can be mounted in folders:
Go to Start-Run, and enter compmgmt.msc. Click on Disk Management. Right-click on the drive containing the documents, choose ‘change drive letter and paths’. Click ‘Add’, and ‘mount in the following empty NTFS folder’. Navigate to a suitable folder (or create one), and click OK. In Explorer, the folder icon you chose will now appear as a disc icon within the tree structure, with that entire drive contents below it.
Nope. I guess that’s what shortcuts are designed to be (however pesky they are in reality). However, a slightly quicker way to get all the shortcuts would be to go through your system, and for each folder you want a shortcut for, right-click and ‘send to desktop’. You can then move all the resulting shortcuts from the desktop to My Music.
Unfortunately, I know nothing about them other than that they are used in places where standard NTFS hard links fail (e.g. across devices). Not sure how to make one, but if you succeed, you may end up with something that quite nicely resembles a Unix soft link.
Here’s a script that will create a directory structure full of shortcuts to the files in other directories. Save it as dirmirror.js and then open up a command window and execute it like this:
var args = WScript.Arguments
var shell = WScript.CreateObject("WScript.Shell");
var fs = WScript.CreateObject("Scripting.FileSystemObject");
var quiet = false;
function Output(str)
{
WScript.Echo(str);
}
function Usage()
{
Output("usage: dirmirror --src <existing_dir> --dest <mirror_dir>");
Output("multiple --src arguments can be used. Example:");
Output(" dirmirror --src \"c:\\music files\" --src \"d:\\more music\" --dest \"c:\\allmusic\"");
Output("make sure to quote directory names if they have spaces");
}
function MakePath(path)
{
if(!fs.FolderExists(path))
{
var dirs = new Array();
dirs[dirs.length] = path;
var newpath = fs.GetParentFolderName(path);
while(!fs.FolderExists(newpath))
{
dirs[dirs.length] = newpath;
newpath = fs.GetParentFolderName(newpath);
}
for(var i=dirs.length-1; i>=0; i--)
{
fs.CreateFolder(dirs*);
}
}
}
function LinkFile(srcpath, destpath)
{
var shortcutpath = destpath + ".lnk";
if(!fs.FileExists(shortcutpath))
{
if(!quiet)
Output("Adding Shortcut: " + shortcutpath + " points to " + srcpath);
var shortcutdir = fs.GetParentFolderName(destpath)
MakePath(shortcutdir);
var shortcut = shell.CreateShortCut(shortcutpath);
shortcut.TargetPath = srcpath;
shortcut.Save();
}
}
function RecurseDir(srcbase, destbase, currentdir)
{
if(currentdir == null)
currentdir = "";
var curdir = fs.GetFolder(srcbase + "\\" + currentdir);
var curfiles = curdir.Files;
var en = new Enumerator(curdir.Files);
for(; !en.atEnd(); en.moveNext())
{
var f = en.item();
LinkFile(f.Path, destbase + currentdir + "\\" + f.Name);
}
var en = new Enumerator(curdir.SubFolders);
for(; !en.atEnd(); en.moveNext())
{
var f = en.item();
RecurseDir(srcbase, destbase, currentdir + "\\" + f.Name);
}
}
function main()
{
var destdir = null;
var srcdirs = new Array();
for(var i=0; i<args.length; i++)
{
var arg = args(i);
if(arg == "--dest")
{
if(args.length <= i+1)
{
Output("Error: --dest arg requires directory following it");
break;
}
else if(destdir != null)
{
Output("Error: cannot specify multiple destination dirs");
destdir = null;
break;
}
else
{
destdir = args(i+1);
i++;
}
}
else if(arg == "--src")
{
if(args.length <= i+1)
{
Output("Error: --src arg requires directory following it");
srcdirs = null;
break;
}
else
{
srcdirs[srcdirs.length] = args(i+1);
i++;
}
}
else if(arg == "-q")
{
quiet = true;
}
else
{
Output("ignoring unrecognized arg: " + arg);
}
}
if(!destdir || !srcdirs || srcdirs.length < 1)
{
Usage();
return 1;
}
Output("Making shortcuts for files in the following dirs:")
for(var j=0; j<srcdirs.length; j++)
{
Output(" " + srcdirs[j]);
}
Output("Putting shortcuts in the following dir:");
Output(" " + destdir);
for(var j=0; j<srcdirs.length; j++)
{
RecurseDir(srcdirs[j], destdir, null);
}
}
try
{
main();
}
catch(e)
{
Output("caught exception: " + e.description + " (" + e + ")");
}
If you are squeamish about trusting random scripts sent to you by semi-anonymous dopers (as you should be), feel free to wait until someone else can vouch for this code doing what I claim it does.
To be a little clearer on the exact behavior of this script, it will create a shortcut in the “destination” directory (or one of its subdirectories) for each file in the “source” directory (or its subdirectories), unless a shortcut with the desired name already exists. So if multiple “source” directories have files with the same name, only the first one found will end up with a shortcut.
Also, if you run it a second time with the same arguments, there will be no effect unless files have been added to one or more “source” directories.
And finally, it spits out a message about each shortcut it is creating, but if you don’t want that, add the “-q” option.