Fix Broken File Path Locations for iTunes Library

I upgraded to a new NAS server and changed the path of my music files.


Z:\Audio\iTunes\ <~ path to my iTunes folder

Z:\Audio\iTunes\iTunes%20Media\Albums\Commercial\ <~ path where iTunes is looking for music files

Z:\Audio\Albums\Commercial <~ path to my music files


The folder structure under Commercial is \Artist Name\[Album Year] Album Title\Song.mp3


Attempted to use FindTracks per How to Fix Broken File Path Locations for itunes Library? but it only found 34 of the 32k+ files in my library.


@turingtest2 Can you help?


Posted on Feb 12, 2024 8:20 AM

Reply
Question marked as Top-ranking reply

Posted on Feb 12, 2024 7:01 PM

Okay, I see what I was doing wrong. I missed the instructions at the top,


"Select a playlist or highlight some tracks in iTunes and then double-click on the script to execute it."

Similar questions

7 replies

Feb 16, 2024 5:23 AM in response to Los Borracho

Hi,


Apologies for the delay in my reply. Work got incredibly busy leaving no time for my hobby helping here. I did have a half composed reply the other day but that got lost in a reboot so I shall have to start over.


The script as written is designed to find tracks in the following general layout:


<Media Folder>\[Music\]\<Artist>\<Album>\[D-]## <Name>.<Ext>


Where artist is album artist if present, or artist if present, or Unknown Artist if both are blank, or Compilations if part of a complication is set. The script can handle certain inconsistencies, such as missing track numbers, or a dash between the track number and the track name, etc. If a perfect match cannot be found the script can also use a fuzzy matching algorithm which can sometimes help if third party software has been used to edit tags and rename files. It should also cope when the usual structure has been flattened as it searches, the media folder, possible artist folders, and possible album folders within those. When it consistently fails then a new search pattern needs to be defined.


You've described your layout thus:


Z:\Audio\Albums\Commercial\Artist\[Year] Boxset Name\Disc 1 Boxset Album Name\Song Name.mp3


Are each of the parts of this either static, or derived from data in the tag? Could you perhaps show me a few concrete examples so that I could replicate the layout at my end, and then tweak the script such that it can successfully relink tracks in that layout?


tt2

Feb 20, 2024 9:22 AM in response to Los Borracho

Hi. Unfortunately iTunes doesn't report the old path when it cannot see the file there, so it isn't as simple as doing a search and replace via a script. Those values are available in an exported XML version of the library, but reimporting an edited version of the XML would reset all of the date added information for each track. If you had let iTunes, or a suitable script, manage the transfer of the files to a new location then that would have worked too, or if you had the library in a portable layout where there is a library folder (normally iTunes) with the .itl file and all media is inside a subfolder of the library folder called iTunes Media that too could have survived a manual relocation to a new drive or path. After the fact it is a little more complicated.


Looking at your examples, admittedly without the benefit of seeing all of the tag metadata, I suspect tweaking my FindTracks script wouldn't be that easy, even though you are clearly familiar with your layout. An alternative approach, somewhat manual, might be to take an exported XML version of your library, use a text editor to perform the necessary search and replace operations on the location properties, and then use the XML file to construct a suitable input file for my Exportmport script. This would require another script to process the XML, extract the GUIDs and local paths, and produce an output file with the corrections to apply to your library.


tt2

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Fix Broken File Path Locations for iTunes Library

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.