Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

One solution for iTunes 'can't find file' problems Apps
If you have your music stored on an external drive, and then run iTunes with the drive disconnected (I have a MacBook Pro, which is only connected to my FireWire drive in my office, but often open iTunes at home to add new music, etc.), you may find that iTunes will report that it can't find the files (a little exclamation mark icon appears next to the song) the next time you run it with the disk re-connected.

This happens because if iTunes can't see your external drive, it returns its music folder location to the default on your hard drive, and it then goes through the library trying to find tracks in certain situations, even if you don't play anything. My solution to this is a bit clumsy (see the caveats), but it's the best one I've found so far.

To stop iTunes from trying to find files while the drive isn't connected, only open iTunes with the root of the library active. Make sure the view is not in a playlist, especially a smart playlist, and use only the list view (so not grouped with cover art, or in coverflow view). This is difficult because you have to remember to deselect playlists and change views when you close iTunes prior to disconnecting the drive.

If you fail to set up iTunes correctly before disconnecting the drive and launching iTunes again, here's how to recover:
  1. Start iTunes without the external drive connected.
  2. Connect the drive.
  3. Go to Advanced -> Consolidate Library. This will copy all music from the external drive to your hard drive.
  4. Close and re-start iTunes.
  5. Go to Advanced -> Consolidate Library. This will copy all music from the hard drive to your external drive.
The final two steps above will bring the library and the actual file locations into line. With 3,729 songs, this took me about 20 minutes, which compared to the alternative -- going to each song, double clicking, and manually locating the file -- is a great result.

Caveats: You obviously need enough hard drive space for your entire library; this will only work if you normally keep all your music in one place; and you'll need to manually delete the copied files from your hard drive after it's done. Please check to see that all files have been properly copied before deleting any, though you should be OK because "consolidate" only copies files, it doesn't move them.

You could do it by re-adding music to the library, which seems to be what most available scripts do, but that loses all your ratings, play counts, date added data, etc. All of those are retained by this method.

[robg adds: I talked this one over with occasional Hints editor Kirk M., and neither of us could come up with a simpler solution that retained all the proper metadata. Personally, I would use the "copy new songs to the library" solution, and just forget about the metadata, but I'm curious to know if there are better solutions out there...]
    •    
  • Currently 2.38 / 5
  You rated: 4 / 5 (8 votes cast)
 
[78,906 views]  

One solution for iTunes 'can't find file' problems | 19 comments | Create New Account
Click here to return to the 'One solution for iTunes 'can't find file' problems' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
One solution for iTunes 'can't find file' problems
Authored by: valx on Dec 01, '06 10:03:15AM

All I did was trash the iTunes folder out of my home's music folder and replace it with an alias to the folder on the external drive. I named the alias "iTunes" so the system believes the proper folder is in place. It has worked flawlessly since then.

If the drive isn't there, then it won't open anything because it believes there is already an iTunes folder in the proper location. It just gives a message that it couldn't find the library. I make sure the external drive is on and restart iTunes. Problem solved.



[ Reply to This | # ]
One solution for iTunes 'can't find file' problems
Authored by: MightyB on Dec 01, '06 10:08:29AM

Does anyone know of a plugin that shows your library location somewhere in itunesw (I'm thinking the bottom bar).

Instead of having to go to preferences, advanced to check each time to confirm...



[ Reply to This | # ]
One solution for iTunes 'can't find file' problems
Authored by: DougAdams on Dec 01, '06 10:39:24AM
Try this AppleScript (copy into Script Editor and save as whatever you wish). It will display the path to your iTunes Music folder in a dialog.

try -- get the XML file, which contains the location of the Music folder
	-- thanks to Sal Soghoian for pointing me in the right direction here
	set these_paths to do shell script "defaults read com.apple.iapps iTunesRecentDatabases"
	set the data_file to the text 19 thru ((the offset of "\")" in these_paths) - 1) of these_paths
	set musicFolder to parse_xml_file((my replace_chars(data_file, "%20", " ")))
	log ("musicFolder: " & musicFolder)
	display dialog (musicFolder as string)
end try

on replace_chars(txt, srch, repl)
	set saveD to AppleScript's text item delimiters
	set AppleScript's text item delimiters to the srch
	set the item_list to every text item of txt
	set AppleScript's text item delimiters to the repl
	set txt to the item_list as string
	set AppleScript's text item delimiters to saveD
	return txt
end replace_chars

to parse_xml_file(thePath)
	-- this grep routine is lifted and modified from "Wicked Cool Shell Scripts" by Dave Taylor, published by No Starch Press
	return (do shell script "grep '>Music Folder<' " & (quoted form of thePath) & " | cut -d/ -f5- | cut -d\\< -f1 | sed 's/%20/ /g'")
end parse_xml_file

---
Doug's AppleScripts for iTunes
http://www.dougscripts.com/itunes/

[ Reply to This | # ]

One solution for iTunes 'can't find file' problems
Authored by: MightyB on Dec 01, '06 11:58:31AM

Doug,

I have actually seen this on your site before...and actually have used it.

I was looking for more of a plugin that displayed it right into the itunes GUI...



[ Reply to This | # ]
One solution for iTunes 'can't find file' problems
Authored by: Frederico on Dec 02, '06 02:48:29AM

I know this isn't what you're looking for, but it is a bit faster than your method: just select 'Get Info' (Command-I) for any track and under the 'Summary' tab (Command-1 if not visible) your current Library path will be displayed.

Also, for the original poster, am I missing something, or would not the ability to use the Option-key startup sequence to choose a different (local) Library work when your FW HDD is detached? Although I agree with the first poster's solution for my situation (I store my library on a network server, and sometimes it is offline), I never have the need to run iTunes without it (ultimately) being able to mount.

It seems that, instead of dealing with inevitable '!' marks, and your complex shutdown requirements, this would be a cleaner, easier solution.

Cheers



[ Reply to This | # ]
One solution for iTunes 'can't find file' problems
Authored by: Frederico on Dec 02, '06 02:59:53AM

OK, I rubbed the week's lack of sleep from my eyes, and reread the original post; I see now the issue is one primarily of Metadata preservation. Sorry. I have a few thoughts, which I will post on the main thread so they are not overlooked by others looking for a better answer.



[ Reply to This | # ]
One solution for iTunes 'can't find file' problems
Authored by: Frederico on Dec 02, '06 03:57:53AM

FWIW, I get a blank dialog (result) for the filepath: "(
\"file://localhost/Volumes/docs/Users/rico/Music/iTunes/iTunes%20Music%20Library.xml\"
)

Not sure where you pull the data path from either, as my music is on a different path altogether, stored on a network drive.



[ Reply to This | # ]
One solution for iTunes 'can't find file' problems
Authored by: mistersquid on Dec 01, '06 11:14:08AM

I do it this way, too. If I accidentally try to play anything when the source library is not mounted and iTunes starts loading exclamation points next to the files in its library, I simply quit iTunes, mount the source library, and then restart iTunes.



[ Reply to This | # ]
One solution for iTunes 'can't find file' problems
Authored by: Mac Berry on Dec 03, '06 06:03:34PM

I've read about this solution before, but what happens then if I try to add something to the library while the external drive isn't connected? Won't it try (and fail) to put the file into the alias?

Surely if it does work as I think it would, then I'm not going to be adding music, and I'm also not going to be playing anything, so I won't have the issue anyway as there's little reason left to open iTunes without the drive connected?

Mark



[ Reply to This | # ]
One solution for iTunes 'can't find file' problems
Authored by: robogobo on Jan 14, '07 03:40:18PM

yes, the alias approach works, and is very simple. Thanks!



[ Reply to This | # ]
One solution for iTunes 'can't find file' problems
Authored by: vsalupo on Dec 01, '06 10:27:53AM

I'm not sure if my situation is different somehow but if I accidentally launch iTunes with my external firewire drive off, the default location on the startup drive appears under the advanced tab just as described.

My fix is real simple. Quit iTunes, power up the drive and relaunch iTunes. In my case, iTunes returns the library to the external drive.

This works even if I update my iPod automatically and import a CD. I use consolidate library to move any podcasts or imports that I may have brought into the library while the external drive was off.

Works almost every time. I'm not sure what causes it but at some point the above procedure will no longer work. It might be the action of locating a "missing" file.



[ Reply to This | # ]
One solution for iTunes 'can't find file' problems
Authored by: Mac Berry on Dec 03, '06 06:07:04PM

Yes that works in that it resets the library location to the external drive, but it doesn't reset the exclamation mark for any files it's tried and failed to find in the "temporary" default location - it still thinks it can't find them.

Or at least, it does for me :(

Mark



[ Reply to This | # ]
One solution for iTunes 'can't find file' problems
Authored by: wert on Dec 01, '06 10:41:47AM
One solution for iTunes 'can't find file' problems
Authored by: Galley on Dec 01, '06 11:24:51AM

If I forget to turn on my firewire drive, I get the prompt you get when you hold down the option button and try to open iTunes. In my case, my library files are on the firewire drive.

---
--
"I'm not a cool person in real life, but I play one on the Internet".



[ Reply to This | # ]
One solution for iTunes 'can't find file' problems
Authored by: barefootguru on Dec 01, '06 11:32:00AM

From my experience, if iTunes can't find a track it always searches the current library.

If I launch iTunes without my external drive mounted, the tracks appear with an exclamation mark. I don't even quit iTunes, just mount the drive and reset the iTunes Music folder location. iTunes does a scan of the library and finds all the songs.

This is also a handy way to move tracks between my two music volumes: move the files in the Finder, then change the iTunes Music folder location to the destination volume.

I wish Apple would bring proper support for music libraries across multiple volumes.



[ Reply to This | # ]
One solution for iTunes 'can't find file' problems
Authored by: Mac Berry on Dec 03, '06 06:09:09PM

Hmm, that's exactly what I want it to do, but for me, it doesn't.



[ Reply to This | # ]
One solution for iTunes 'can't find file' problems
Authored by: Frederico on Dec 02, '06 03:39:05AM

As posted above in a side thread, would not the ability to Option-key-launch iTunes, which allows for multiple Library use, at least prevent all the tedious shutdown precautions, and consolidation issues?

As I understand it, the ultimate problem stems from the desire to consolidate music stored locally when away from the FW HDD, to said FW HDD when next available, yet the preservation of metadata is the sticking point, yes? If you could transfer that metadata intact, would this not be better than lengthy consolidations of entire library contents? Yours is rather small; between audio and video, mine is more than 200GB and ~20K titles; I'd shudder to think about that kind of transfer time.

I have a related issue in that I add all newly created music, rips, videos, etc. and iTunes Store purchases to my main workstation at home, but I periodically want to use all that content on my work network, and, I, too, do not want to have to regenerate (at least part of) the metadata, ratings, in particular. My solution is to write the normally non-transferable ratings to the comments field of each track via AppleScript, then transfer the items to work, add to the work iTunes Library, and use the same AppleScript to write the ratings back to the Ratings field. Since I treat ratings as a fairly static assessment of a song's overall quality, I am not worried about synchronizing any rare changes on either end.

To assist in the process, I create two smart playlists on the master machine; one looks for tags in the Comments field to see if the metadata has been applied to the field, and if it matches the currently displayed metadata; if not, it is added to the list indicating the Comments field requires updating; the second list on the master machine lists all songs whose metadata is current and was added after the last transfer date, this serves to both prompt me to backup these items for safety, and I use those backup disks to transfer the songs to work.

At work, there is a smart playlist that looks for tracks with metadata in the comments field that does not match the locally displayed data, and this limits the number of tracks to be updated from the comments field.

I started this meta-comments practice the first time I lost my iTunes Library, and could not repair it, and my least-old, non-corrupted backup was so old that it took better than 30 hours to redo. I was not happy. By having the desired metadata in the comments field, it is always attached to the ID3 tag embedded in the file itself.

I sure wish we could add our own ID3 tag fields. I realize that "sharing" ratings and play-counts and such is not always desirable when "sharing" songs, and thus it is overlooked as needed by whomever write the ID3 specs, but I think it should be easier to retain such data if you so choose.

It should also be possible to extract metadata from one Library.xml file and use it to replace the data in another, but it would require iTunes not be running, I think, and would take a fair amount of scripting via the shell using grep, and a whole bunch of error checking to prevent issues with duplicate tracks.



[ Reply to This | # ]
One solution for iTunes 'can't find file' problems
Authored by: Mac Berry on Dec 03, '06 06:21:37PM
As I understand it, the ultimate problem stems from the desire to consolidate music stored locally when away from the FW HDD, to said FW HDD when next available, yet the preservation of metadata is the sticking point, yes? If you could transfer that metadata intact, would this not be better than lengthy consolidations of entire library contents? Yours is rather small; between audio and video, mine is more than 200GB and ~20K titles; I'd shudder to think about that kind of transfer time.
Not quite. The consolodate function works perfectly for copying (I do wish it would move rather than copy though) music from my local drive to the external one, if I've added that music to my library while the external drive is disconnected, meta data included. What it doesn't do is re educate the library to know that pre-existing music is now available again on the external drive, if it's tried to find it while the drive wasn't there. Option launch allows a second library to be used, but that doesn't solve the issue either, because I don't want music I add while away from the drive to go into a second library, mainly because it won't be staying there and so will be "unfound" when I next use that "mobile" library. What I really want it to do is keep the path to the library as I set it, whether or not the drive is connected, tell me that the path isn't available (but not actually change anything) if I try to play or otherwise interact with a file while disconnected, and use a temporary location for music I add while disconnected. Ideally it would then also move that new music to the external drive when it does become available.

[ Reply to This | # ]
One solution for iTunes 'can't find file' problems
Authored by: Frederico on Dec 06, '06 08:34:32AM
I guess I didn't write very clearly while being so sleepy. The methods I describe will do what you are asking, save the prevention of launching when your external drive is offline. Before iTunes was smart about dealing with unmounted network shares, this was resolved, again, with AppleScript.

A simple script can be written as an iTunes launcher (a clickable app, or, my preference, a script invoked by keystroke through a long list of available keystroke-launchers) to detect if your standard external drive path is present, and, if not, either mount the share (if available), prompt you to find the share manually (assuming it should be available but is not), or cancel the launch of iTunes. Note: use of this type of setup all but necessitates the need to turn off auto-launching of iTunes by such things as Audio CD insertion, iPod mounting, etc.

In your case, you would want this launcher to prompt you to use a local Library, to prevent the dreaded '!' effect. This should be possible by using 'keystroke down' commands from Standard Additions; at worst, it would ask you to hold the 'Option' key after a resulting dialog.

Example (less than two minutes work):

set myExernalDrive to "MusicDriveName"
if (list disks) contains myExernalDrive then
	tell application "iTunes" to activate
else
	display dialog "The drive " & myExernalDrive & 
		" is not present." & return & return & 
		"Please hold the 'Option' key down and Press 'Continue' 
	to allow iTunes to choose an alternate Library."
	tell application "iTunes" to activate
end if


Once you are up and running locally, use iTunes as desired, add tracks, etc.

Before closing iTunes, transfer metadata of new tracks to comments field.

Upon launching iTunes (via special launcher), the same script should now allow you to not only reselect your external library, but also easily detect the existence of files added to your local library, and add them to your master external. You can also choose to move them (best to copy then delete, for safety sake) at your option. The script can also then automatically deal with the updating of metadata to the master.

This sounds complex, but much, if not all of it has already been written in component form, and need only be combined. Even the repair of the dreaded '!' issue is easily resolved by simply using the 'Add to Library' command, though, I seem to think that any "Missing Tracks" that are mis-reported when a drive is temporarily not available are now automatically fixed the next time it is.

[ Reply to This | # ]