This discussion is locked
Didou

Q: How to edit iTunes database outside of iTunes

Hello everyone,

After a successfull (more or less) migration of my user account in Windows, I've found myself with a small problem concerning iTunes. The "My Music" folder of the user account was tranferred including the iTunes database & its Library folder. Outside of this folder I had another folder (located in D:\multimedia\lossless) which was also added to the iTunes database & now this folder is in E:\multimedia\lossless).

A lot of songs contained in that external folder are used in playlists & I have stats & ratings on them that I don't want to lose. With that being said, how could I modify the iTunes database (after a careful backup of course) so that every occurence of the path d:\multimedia\lossless could be changed into the new location e:\multimedia\lossless ?

I really need help on this so thanks in advance so anyone who could help.

MacBook Pro 2.4GHz (15"4) 4096MB PC5300 DDR-II, Mac OS X (10.6), 80GB iPod Classic (black) - 8GB iPod nano (Chromatic blue) - 16GB iPhone (white)

Posted on May 24, 2010 10:37 AM

Close

Q: How to edit iTunes database outside of iTunes

  • All replies
  • Helpful answers

  • by Katrina S.,Helpful

    Katrina S. Katrina S. May 24, 2010 10:59 AM in response to Didou
    Level 7 (24,096 points)
    May 24, 2010 10:59 AM in response to Didou
    You can edit the iTunes Library.xml file and use the edited XML file to rebuild the ITL database.
    This will keep all metadata except Date Added.
    If you care about Date Added, your only option is to re-link the files one-by-one.



    iTunes has to have an ITL file to open & run. There are 3 ways it gets one:
    1) If no ITL file exists, it creates a new one (blank library)
    2) If it finds an existing ITL, it uses it and ignores the XML file.
    3) If it finds a damaged ITL, it looks for an XML file and tries to rebuild the ITL from that.




    You need to edit the XML file and replace all the paths from D: to E:.
    Then damage the itl. Open it in WordPad, select everything, and hit delete. Save it with zero bytes (nothing) in it.
    This will force itunes to re-create it by looking at the XML file.



    Like you said, be sure to make backup before doing this.
  • by turingtest2,

    turingtest2 turingtest2 May 24, 2010 11:18 AM in response to Didou
    Level 10 (86,976 points)
    Apple TV
    May 24, 2010 11:18 AM in response to Didou
    You can't edit the iTunes database directly. Which version of Windows are we talking about here? Can you move them back to D:\multimedia\lossless\, at least temporarily? iTunes reports the location of "missing" files as "unavailible" which makes it hard to write a script which does a search & replace on the missing files. I do however have a script which will move things that can be found to a new location and updates iTunes as it goes, thereby preserving all metadata.

    An alternative possiblity would be to create a "junction" so that D:\multimedia\lossless actually points to the folder on E:\ then create a script that updates the locations without needing to physically move the files. Once the update is complete the junction could be deleted. Or you could just create the junction and leave things as they are...

    tt2

    Oops, we talking Mac or PC? Talk of drive letters says PC but the sig says otherwise? Macs can also support junctions aka symbolic links... Ignore me...

    Message was edited by: turingtest2
  • by Didou,

    Didou Didou May 24, 2010 1:29 PM in response to turingtest2
    Level 1 (16 points)
    May 24, 2010 1:29 PM in response to turingtest2
    Most of my music is on my desktop computer which happens to run Windows 7 Home Premium (64-bit if that's of any help. That's the system on which I've moved the files/folders & unfortunately I can't move them back to D:, that drive is being used for something else at the moment.
  • by Didou,

    Didou Didou May 24, 2010 1:30 PM in response to Katrina S.
    Level 1 (16 points)
    May 24, 2010 1:30 PM in response to Katrina S.
    I think I'm going to take a shot at that. Edit the XML file & then damage the ITL so that iTunes can rebuild it from the modified XML one.

    Thanks for the information.
  • by Didou,

    Didou Didou May 25, 2010 3:33 PM in response to Katrina S.
    Level 1 (16 points)
    May 25, 2010 3:33 PM in response to Katrina S.
    After doing a backup, I edited the XML file then "damaged" the .itdb files. iTunes upon launching recreated everything from the XML & now after a few tweaks in the settings, everything is back to the way it was.

    Thanks for the help.
  • by Katrina S.,

    Katrina S. Katrina S. May 26, 2010 1:00 AM in response to Didou
    Level 7 (24,096 points)
    May 26, 2010 1:00 AM in response to Didou
    You're welcome, and thanks for the points.