The correct way to migrate your library is to copy the entire iTunes folder from the old computer (or a backup) into <User's Music> then install iTunes. Nothing needs to be imported, you get your library with your playlists, ratings, playcounts etc.
If you only have the media folder press CTRL+B to see a menu bar with more options including File > Add Folder to Library which is probably what you were looking for.
I tried importing the library through the second option you had but nothing happened.
I have the iTunes Library ITL file and the xml file.
If all else fails I can go to where the old computer is (my parents) to get the whole of the iTunes folder - just thought I'd be able to do it with just the file itself.
...just thought I'd be able to do it with just the file itself.
Oh no, the .itl file is a database that records where the media files are located and various details about them. You need the entire iTunes folder, and if located separately, all of the media folder(s) too.
These are two possible approaches that will normally work to move an existing library to a new computer.
- Backup the library with this User Tip.
- Deauthorize the old computer if you no longer want to access protected content on it.
(Ignore this ^ bit since you're going to clone the library)
- Restore the backup to your new computer using the same tool used to back it up.
- Keep your backup up-to-date in future.
Connect the two computers to the same network. Share your <User's Music> folder from the old computer and copy the entire iTunes library folder into the <User's Music> folder on the new one. Again, deauthorize the old computer if no longer required.
Both methods should give the new computer a working clone of the library that was on the old one. As far as iTunes is concerned this is still the "home" library for your devices so you shouldn't have any issues with iTunes wanting to erase and reload.
I'd recommend method 1 since it establishes an ongoing backup for your library.
Note if your device syncs with contacts or calendar items you should either migrate this data separately or create one dummy entry of each in your new profile and iTunes should merge the existing data from the device.
If your media folder has been split out from the main iTunes folder you may need to do some preparatory work to make it easier to move. See make a split library portable.
Should you be in the unfortunate position where you are no longer able to access your original library or a backup then then see Recover your iTunes library from your iPod or iOS device for advice on how to set up your devices with a new library with the maximum preservation of data.