Apple Intelligence now features Image Playground, Genmoji, Writing Tools enhancements, seamless support for ChatGPT, and visual intelligence.

Apple Intelligence has also begun language expansion with localized English support for Australia, Canada, Ireland, New Zealand, South Africa, and the U.K. Learn more >

You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

📰 Newsroom Update

Apple Music expands live global radio offering with three brand-new stations. Learn more >

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Apple Music points to wrong locations for only some music files - how to edit file locations?

Is there a way to edit/change the file location reference for individual music files that already have a file location that is incorrect in Apple Music?


Several music files that played in years past cannot be played now. The file location under "Get Info" in the Apple Music points to a completely different location and a completely different file type. It has the metadata for the song, but points to the wrong file. This is NOT for the entire music library, only about 150 or so music files. The correct music file is in the correct location on the hard drive because it is part of an album, and some songs on that album DO reference the correct file location in Music.


I've tried different key combinations when selecting "Get Info" to find a way to change the path but no luck.


I've exported the Music Library XML file (Library=>Export Library...) and was able to find the file reference and change it using Atom, but when I imported the XML back into Music, the location was still wrong. (even if this worked, this method would be hugely time consuming going one by one).


Is there a way to change the file location reference for individual music files that already have a file location that is incorrect?


I'm using Music 1.2.5.7 on an iMac running OS X Monterey v12.5.1

iMac 27″, macOS 10.13

Posted on Aug 23, 2022 1:15 PM

Reply
Question marked as Top-ranking reply

Posted on Aug 26, 2022 11:07 AM

Hello again.


I've made an updated version of the FixLinks script which I've called FixBadLinks. You can download it from this link: FixBadLinks.zip. Extract the script file and place it in ~/Library/Music/Scripts if you want to be able to call it from the Music menu bar.


It should still attempt to repair any missing items but now also checks that each link points to something inside the chosen media folder, and if not tries to find a correctly named file within the media folder to link to.


Please try this modified version and see if it works as needed.


tt2

Similar questions

14 replies
Question marked as Top-ranking reply

Aug 26, 2022 11:07 AM in response to Boston_To_LA

Hello again.


I've made an updated version of the FixLinks script which I've called FixBadLinks. You can download it from this link: FixBadLinks.zip. Extract the script file and place it in ~/Library/Music/Scripts if you want to be able to call it from the Music menu bar.


It should still attempt to repair any missing items but now also checks that each link points to something inside the chosen media folder, and if not tries to find a correctly named file within the media folder to link to.


Please try this modified version and see if it works as needed.


tt2

Aug 23, 2022 1:39 PM in response to Boston_To_LA

The "missing file" issue with exclamation marks happens if the file is no longer where iTunes or Music expects to find it. Possible causes are that you or some third party tool has moved, renamed or deleted the file, one of its parent folders, the drive it lives on has had a name change, or you've moved a non-portable library to a different path (see Make a split library portable for details). It is also possible that iTunes or Music have changed from expecting the files to be in the pre-iTunes 9 layout to post-iTunes 9 layout, or vice-versa, and so is looking in slightly the wrong place, or that you've been too aggressive when deleting duplicates at some point.


Select a track with an exclamation mark, use Cmd-I to get Song Info, then click No when asked to try to locate the track. Look on the file tab for the location the library thinks the file should be. Now take a look around your hard drives. Hopefully you can locate the track in question. If a section of your library has simply been moved, a folder renamed, or a drive label has changed, it should be possible to reverse the actions. If the difference between the two paths is an additional Music folder in one path then this is a layout issue. I can explain further if that is the case. If everything is where it is supposed to be try Repair security permissions for iTunes for Mac - Apple Community.


In some cases the library may be able to repair itself if you go through the same steps with Get Info, or when playing a track, but this time click Locate and browse to the lost track. It may then offer to attempt to automatically fix other broken links. Although it says something like "use the same location" I think it expects to find the tracks in the same artist & album layout they were in previously, with one systematic change to the path.


If you want me to try to provide specific advice please post back the following details:

  1. The location of the media folder under iTunes|Music > Preferences > Advanced
  2. The location of a sample missing track shown under Song Info > File > Location that begins file://
  3. The true path to the file whose details you gave in 2



See also FixLinks - an AppleScript to repair broken links in Music - Apple Community.



tt2

Sep 2, 2022 9:40 AM in response to Boston_To_LA

Boston_To_LA wrote:

... but get the following message:

"File not found at:
/Volumes/Personal/Dropbox (Personal)/ITunes Library/Music/Brooks & Dunn/Brand New Man/Brooks & Dunn/Brand New Man/01 Brand New Man.mp3

... Any thoughts?


The fact that the band and album title appears twice in that message suggests you're starting the search too deep. You should be pointing the script at /Volumes/Personal/Dropbox (Personal)/ITunes Library/Music and it should be able to repair tracks from multiple albums and bands in one go.


tt2

Aug 27, 2022 2:42 AM in response to Boston_To_LA

It should be ~Users/myname/Library/Music/Scripts.


You can run the script from anywhere in the Script Editor, but putting it in the right folder means you get this bonus menu in Music that makes it easier to access. You may have to restart Music after saving the file in the right place for the menu to appear, and you'd only have the one entry.



tt2


Aug 23, 2022 3:47 PM in response to turingtest2

Thank you for the reply. I saw this reply on a different post and attempted some of the fixes. The subject files do not show an exclamation point. When I sync to my iPhone I get an error log showing some files could not be located, and also some files cannot be played in Music.


For the songs which DO show as missing, through Cmd-I, I can successfully select Find File and point those to the correct file location and it's fixed.


Selecting one of the errant songs which the error log says are not compatible, Cmd-I shows all the correct metadata but, the file location points to a .js file in my FamilyTreeMaker directory (or to other various locations). Because there is already a file location assigned to this song (albeit the wrong location), the option to Find File does not come up.


I suppose I could create a new, empty library and repopulate it, but I'm concerned between downloading and copying, there might be a risk of creating dupes.


Any thoughts?

Aug 23, 2022 5:00 PM in response to Boston_To_LA

Music & iTunes assume that everything is where it is supposed to be and only show the exclamation marks once they have found out otherwise. They might show after syncing, or when a drive is disconnected at launch time. You can try this method to highlight the tracks that need fixing.


Lost & Found Playlists

Create a playlist called Found, select everything in Songs and drag it into the Found playlist. Create a smart playlist called Lost matching only Music items and the rule Playlist is not Found. Your lost tracks will be in this playlist.




The incorrect link to .js files is a new one on me. It should be possible to tweak FixLinks such that, for example, instead of skipping over tracks that have a location property it skips over those that are located within the media folder, allowing other tracks to be potentially reconnected to valid files.




tt2

Aug 26, 2022 9:31 AM in response to turingtest2

Thanks for the suggestions, I'll give your solutions a try. So you don't think I'm nuts, when I sync my iPhone to the Mac, one of the error messages in the error log is: “Brand New Man” was not copied because the file type is not supported by the iPhone “iPhone 12”.


To give you some more insight, following are two records from the exported Music XML file. They refer to songs from the same artist/album (the second one is referenced in the error log above). Info in the first record is all correct whereas in the second record, all the info is correct except the file location points to an Italian language help file for an old Eye One Match color calibrator. Hence, the error that the file type is not supported. I think that somewhere along the line, over years of OS upgrades and iTunes upgrades and migration to Music, some links must have somehow gotten scrambled. Oh, one more tidbit, I have not thoroughly analyzed this so it's not 100% certain, but so far it looks like the scrambled file locations are from CDs I ripped a long time ago.


<dict>


<key>Track ID</key><integer>2845</integer>


<key>Name</key><string>Cheating on the Blues</string>


<key>Artist</key><string>Brooks &#38; Dunn</string>


<key>Album Artist</key><string>Brooks &#38; Dunn</string>


<key>Composer</key><string>Chick Rains/Don Cook/Kix Brooks</string>


<key>Album</key><string>Brand New Man</string>


<key>Genre</key><string>Country</string>


<key>Kind</key><string>MPEG audio file</string>


<key>Size</key><integer>2768672</integer>


<key>Total Time</key><integer>172120</integer>


<key>Track Number</key><integer>4</integer>


<key>Year</key><integer>1991</integer>


<key>Date Modified</key><date>2010-11-18T22:30:13Z</date>


<key>Date Added</key><date>2016-04-10T16:41:51Z</date>


<key>Bit Rate</key><integer>128</integer>


<key>Sample Rate</key><integer>44100</integer>


<key>Play Count</key><integer>4</integer>


<key>Play Date</key><integer>3743926107</integer>


<key>Play Date UTC</key><date>2022-08-21T18:28:27Z</date>


<key>Normalization</key><integer>2336</integer>


<key>Persistent ID</key><string>625FDF04D24DD346</string>


<key>Track Type</key><string>File</string>


<key>Location</key><string>file:///Volumes/Personal/Dropbox%20(Personal)/ITunes%20Library/Music/Brooks%20&#38;%20Dunn/Brand%20New%20Man/04%20Cheating%20on%20the%20Blues.mp3</string>


<key>File Folder Count</key><integer>5</integer>


<key>Library Folder Count</key><integer>1</integer>


</dict>


<key>2847</key>


<dict>


<key>Track ID</key><integer>2847</integer>


<key>Name</key><string>Neon Moon</string>


<key>Artist</key><string>Brooks &#38; Dunn</string>


<key>Album Artist</key><string>Brooks &#38; Dunn</string>


<key>Composer</key><string>Ronnie Dunn</string>


<key>Album</key><string>Brand New Man</string>


<key>Genre</key><string>Country</string>


<key>Kind</key><string>MPEG audio file</string>


<key>Size</key><integer>292</integer>


<key>Total Time</key><integer>261694</integer>


<key>Track Number</key><integer>5</integer>


<key>Year</key><integer>1991</integer>


<key>Date Modified</key><date>2009-10-15T23:01:18Z</date>


<key>Date Added</key><date>2016-04-10T16:41:51Z</date>


<key>Bit Rate</key><integer>128</integer>


<key>Sample Rate</key><integer>44100</integer>


<key>Persistent ID</key><string>20744769E88B6070</string>


<key>Track Type</key><string>File</string>


<key>File Type</key><integer>1413830740</integer>


<key>Location</key><string>file:///Applications/Eye-One%20Match%203/Eye-One%20Match/Contents/Resources/Italian.lproj/Help/i1Display/Start/Step5.txt</string>


<key>File Folder Count</key><integer>-1</integer>


<key>Library Folder Count</key><integer>-1</integer>


</dict>

Aug 26, 2022 7:22 PM in response to turingtest2

Wow. Thank you so much for adding those adjustments to your script. I really appreciate your help.


Now the plot thickens... It's interesting because it seems that I do not have a ~/Library/Music/Scripts folder. Did a search in Finder for folders named "Scripts" and separately for folders named "Music". Scripts exists in various folders but not under Library or Music. Following are the Library folders I found with only one having a /Music folder:


Macintosh HD/Library/

~/System/Library/

~/Users/Shared/Library/

~/Users/myname/Library/Music/Music/


I added Scripts folders as follows and copied the FixBadLinks.scpt to each:

~Users/myname/Library/Music/Music/Script/

~Users/myname/Library/Music/Script/


Opened and closed Music app a few times and do not see the script showing in the Music menu bar.


Thoughts?

Sep 2, 2022 8:38 AM in response to turingtest2

Thank you again for modifying the script. Just got to running it thru ScriptEditor, following the instructions but get the following message:


"File not found at:

/Volumes/Personal/Dropbox (Personal)/ITunes Library/Music/Brooks & Dunn/Brand New Man/Brooks & Dunn/Brand New Man/01 Brand New Man.mp3


Continue reporting?"


The filename in that folder is correct "01 Brand New Man.mp3"


I've run the script on several different songs and get the same message. Any thoughts?

Sep 6, 2022 7:22 PM in response to turingtest2

Sorry for the late reply. Just got to re-running the script and... making progress! Followed your instructions and created a Found playlist and a Lost smart list. Selected all the songs in Lost, ran the script, pointed to the higher-level directory and... Success!! (with one more error message)


551 items were processed,

475 items were updated,

76 items were not located.


This error came up multiple times "Edit script to provide extension for tracks of kind Protected AAC audio file"


PS - I scrolled through your script... wow. That's a lot of coding for this. Thank you for creating the script!

Apple Music points to wrong locations for only some music files - how to edit file locations?

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