Check out this Python script! It's set up for windows, but it would not be hard (for a Person Who Does Programming For Real) to get it working on apple. But this script in fact finds all the tracks on the disc but not in the library.http://blog.avirtualhome.com/managing-the-itunes-library/
The difficulty is that the iTunes library list is in XML, and shell scripts generally don't parse XML easily, hence the use of Python.
And sure enough, after just these edits, it seems to work for me:
| theITunesDirectory = '/Users/leeduncan/Music/iTunes'
| theLibraryFile = os.path.join(theITunesDirectory,
| 'iTunes Music Library.xml')
| theMusicPath = '/Users/leeduncan/Music/iTunes/iTunes Music'