Skip to content

Instantly share code, notes, and snippets.

@phs
Created October 15, 2012 23:42
Show Gist options
  • Save phs/3896391 to your computer and use it in GitHub Desktop.
Save phs/3896391 to your computer and use it in GitHub Desktop.
Compare /iTunes/Music against a Library.xml in the local directory
# Open up Terminal.app, cd to the directory containing Library.xml, then paste this bad boy.
#
# What's going on:
# 1. find: recursively print the names of all files under /iTunes/Music
# 2. sed: Strip off the leading '/iTunes/Music/' prefix, since it probably won't be in Library.xml
# 3. while: for each such filename..
# 4. grep: see if it appears in Library.xml
# 5. ||, echo: if not, print it out.
find /iTunes/Music -type f | sed 's|/iTunes/Music/||g' | while read filename; do grep -q "$filename" Library.xml || echo "$filename"; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment