I recently had a mammouth clean-up of my iTunes libraries, which basically involved bringing everything together in one new location on an external HD, and re-importing 10,098 tracks into iTunes (that's about 59GB of music). Problem was, I ended up with a few thousand less tracks actually in iTunes than expected, no matter which obvious way of importing them I used. I had tried dropping my content into the "Automatically Add to iTunes" directory, and I'd tried dropping my content from the Finder directly into the iTunes window (each time about a dozen artists per batch, in case it failed half way through). Here's what finally worked…
EDIT: I don't think I tried File -> Add to Library, as the thought of managing 10,000 tracks through a tiny dialog box in batches of a dozen or so artists didn't appeal.
So… there's plenty of software which locates "missing tracks" – tracks iTunes knows about but which are no longer where they should be in the file structure – but that's a red herring. I couldn't find anything explaining the opposite, hence writing this blog post.
In fact the solution is remarkably simple, though discovering it took time as the failed attempts with this many tracks were very time-consuming.
So, after dropping batches of 'artist' folders into the iTunes window (each containing possibly multiple 'album' folders, each containing multiple tracks), I had 39GB in iTunes when Finder was reporting 59GB of content in the folders. The file structure itself would be taking up some space, but not 20GB. Where were the missing tracks?!
Basically, you need to drop files rather than folders of files into the iTunes window. Easier said than done when your files are spread over hundreds of nested folders. I also did them in groups by file type (I read somewhere that this might make a difference, but I have no idea if it did).
To do this, I typed MP3 the search box in the top right of my Music folder window, filtering to the current folder and file name. The "+" icon to the right expands some advanced options, letting me refine to "Kind" is "Music" – then I deleted MP3 from the search box (one character at a time, as clicking the 'X' cancels the search entirely).
So now I have a raw list of all music files within the Music folder, but without the directory structure. Dragging and dropping all the tracks from here was the only thing that worked without missing any tracks. In fact, since most of the tracks were already in iTunes, it fairly quickly worked out what was missing and added just those. You don't need to worry about it adding duplicates – it won't.
The lesson I've learnt? Don't drag folders of music into iTunes – it may miss tracks without telling you, and you may find out when it's too late (especially if you have hundreds of 90s back-catalogue b-sides which you can't easily rip from CD again).
UPDATE: I've found a great bit of software called Song Sergeant, which among other handy library-cleanup actions, "discovers orphaned song files which exist within your iTunes music folder but do not appear in iTunes itself" — this is exactly what I could have done with a week ago!