This is a quick shell script to parse the location of music files out of an iTunes Library.xml file, sort, and write to Library.txt. I am sure there are ways to do the same thing better, or faster, but in the few minutes this took me to write, it works great, and made short work of the 2MB file I pointed it at.
#!/bin/sh
files=`grep 'Location' /Users/admin/Desktop/Library.xml | \
sed 's/<key>Location<\/key><string>//g'| sed 's/<\/string>//g' \
| sed 's/%20/ /g' | sort`;
old_IFS=$IFS
# IFS by default is space tab return, and stands for
# Internal Field Separator.
IFS='
'
for i in $files
do
`echo $i >> /Users/admin/Desktop/Library.txt`;
done
IFS=$old_IFS
[robg adds: I tested this, and it worked by simply copying and pasting the above code. I'm not positive this handled the "space tab return" bit properly, but I get one line per entry in my library, so it worked well enough for me. The end result is a text file showing the full path to every file in your library. To make the above script work, you'll need to change the admin entry to your admin user's name. You'll also have to copy and rename your iTunes Library file to the desktop and rename it to Library.xml (or the script could be changed to read the original file).]
Mac OS X Hints
http://hints.macworld.com/article.php?story=20040930110913453