hacking iTunes paths

so unless you’ve been living under a rock, you know that we’ve moved to Slovakia. ┬áduring the move, I was unable and unwilling to pack my computer up to bring with us. it was just too large to be feasible. the next best thing was to backup my digital life onto an external hard drive–which chelsea so conveniently gave me for christmas–and bring that with us instead. one problem with this is that, as with every other time that I had to wipe my hard drive, I would be forced to re-import my entire iTunes library into iTunes, and if you’ve ever tried to import an iTunes library, it’s better than starting from scratch, but it sucks. playlists don’t sync properly, especially if they are based on other playlists. and the add date for all your songs becomes the same date, which I use in many of my playlists (recently added, etc.) but I think I found a solution to my problems…

my parents were in a situation where they were using several user accounts on the computer, but wanted to share the iTunes library across all the accounts. this posed some problems, and I hacked in a workaround, where iTunes stored all the music in the same folder, but it wasn’t elegant, and it didn’t work quite right.

they recently had some computer issues which forced them to reformat their hard drive (ok, fine, forced ME to reformat their hard drive), and they again wanted to share the same iTunes library. so while thinking over how I could more easily get their iTunes library to work across multiple accounts, and be more elegant than the solution I tried last time, I realized that the same solution could possibly work for me.

the solution that I realized for my parents computer and their multiple accounts is as follows:  on a *nix system, there is a thing you can do called a link (more precisely, a symbolic link), where one location actually points to another location. for instance if I had a directory at /bin which has a symlink pointing to it at /home/usr/bin, when I go to /home/usr/bin, I’m actually getting the contents of /bin, but the computer thinks I’m getting /home/usr/bin. a bit confusing i know, but trust me, it’s cool and extremely useful.

if you are using windows, windows doesn’t have symlinks per se, but if you’re using the NTFS file system (and if you’re on anything above win 2000, you should be), there is an almost identical thing you can do called a junction. and it’s made easier by downloading a small utility called NTFS Link.  with this, you can point any empty folder to any other folder on the computer, and when you navigate to that folder, the contents inside are actually in another location on the computer. this gave me an idea…

iTunes has a horrible habit of wanting to store it’s data files in the documents folder of the user. this poses a problem for trying to use the same library for multiple accounts, as each account has it’s own documents folder. what I did, was created a new folder in the root of the C: drive called “iTunes”, and created another folder inside that folder called “__iTunes Data” (the underscores are to keep it near the top of the folder when sorted).  I then opened iTunes with one of the accounts on the computer, which created the folder \My Documents\My Music\iTunes. I then closed iTunes, and moved the contents of that folder into the __iTunes Data folder I just created. after that, I right clicked on the now empty \My Music\iTunes folder and symlinked it to the __iTunes Data folder. now, iTunes goes looking for it’s data in the \My Documents\My Music\iTunes folder, but it’s actually looking in the C:\iTunes\__iTunes Data folder, but it has no idea. I then get into iTunes, and set the advanced preferences and change my iTunes Music Folder location to C:\iTunes.

mission accomplished. iTunes now thinks that it’s accessing it’s data in the documents folder, when really it’s in a different location (__iTunes Data), which can easily be linked to from all the other iTunes “accounts”.  just do the same thing for the other accounts, make a junction from \My Documents\My Music\iTunes to C:\iTunes\__iTunes Data, and set your library location in iTunes to point to C:\iTunes, and everybody is now using the same library. one thing to make sure you set, is while you’re setting the Music Library location, also check “Keep iTunes Music folder organized” and “Copy files to iTunes Music folder when adding to library” this keeps everything nice and tidy, and when one account adds music, it gets copied into the iTunes music folder, and all the other accounts can access it as well.

now on to how this helped me…  I realized that, while this works perfectly for multiple accounts on the same computer, my problem is a bit different. I have only one account, and all of my data is on an external hard drive, including my library data files. so what did I do?  I set up iTunes exactly as I had set up the iTunes for my parents, except that I then emptied out and linked the C:\iTunes folder to the location of my external hard drive library (which is at G:\Music\Benjam’s Music).  so now I have a perfectly functioning iTunes library, with no import required, and to top it off, when I need to wipe my hard drive again, I just set this up as it is now on the “new” computer, and it will behave as if it had never changed. all I might have to change is where C:\iTunes is pointing to.

here are those instructions again, in a nice easy-to-follow list (this only works with NTFS on XP, although if you have another method of creating symlinks in your system (which Vista does, google “mklink”), that would work as well):

  1. download and install NTFS Link
  2. download and install, or update iTunes
  3. create a folder in the root of your C drive called iTunes (or whatever)
  4. [Optional step] right click on your new folder and link to the location of your iTunes music
  5. create a folder inside C:\iTunes called __iTunes (or whatever)
  6. [Skip this step if you have an existing library] open iTunes once (this creates the \My Music\iTunes directory and creates some initial files in there)
  7. go to the iTunes preferences, and the Advanced tab, and set the location for the iTunes Music Library to C:\iTunes
  8. check both of the boxes below that, save, and close iTunes
  9. move all the files in \My Music\iTunes into C:\iTunes\__iTunes
  10. alt click on \My Music\iTunes and NTFS link that to C:\iTunes\__iTunes
  11. open iTunes, add your music, enjoy

(this also works with pre-existing libraries, just move your music into the C:\iTunes folder, and move your \My Music\iTunes data into the __iTunes folder, and iTunes will see it like nothing changed)

3 Replies to “hacking iTunes paths”

  1. I can help you make it work with Vista and iTunes, but I don’t know much about the Zune software… and if it’s breaking things every time you update, then it’s probably the software and there’s not much you can do about it. Sorry.

  2. Benjam,

    This is pure genius. Now you need to figure out how to make this work for me on Vista and with the Zune software! :) I, too, use the dates so when it forces me to re-import all my songs everytime Zune puts an update out, it re-adjusts all the dates to the day that I installed the update. :( I hate it. I’m wondering if this would help or be possible.

  3. so I am hoping you can help me with a similar thing. I am going to be buying in the very near future two 1 terabyte hard drives. (Double back up.) The more photos I take the more terrified I am going to crash and burn. To make it worse my DVD burner is not working. I don’t want to mess with it for fear of loosing the data I want to back up. I bought one external that died on me already, hence the double back up. Thank the good lord I didn’t wipe my comp.

    So back to the topic. Kati and I want to share the same Itunes library in two different computers. Ideally the the music will be stored to the external hard drive (G:) and as we download stuff independently, I would like to be able to link up with G: and have it all consolidate. And take all the music from our laptops and move them permanently to the external hard drive. then drive H: will just back up drive G:

    Is this possible? If yes, can you do it? If yes, are you willing to do it? If yes, do you have the time to do it? If yes, are you able to do it, and explain to me how to do it?

Comments are closed.