#!/bin/bash\# itunes_sanity.sh - fix dir names created by iTunes\# only works for mp3s, and not actually tested on a Mac\# created by scruss on Sun Sep 4 22:05:00 EDT 2005\# edited by vraa on 2007 july 2xsomething...\find "$@" -type d -mindepth 1 | while read directory\do\ artistdir=$(dirname "$directory")\ firstfile=$( find "$directory" -type f -iname '*.mp3' | head -n1 )\ artist=$( id3info "$firstfile" | egrep ' TYE ' | sed 's/=== TP1 (Lead performer(s)/Soloist(s)): //; s/[^0-9]*//;' )\ album=$( id3info "$firstfile" | egrep ' TAL ' | sed 's,=== TAL (Album/Movie/Show title): ,,;' )\ echo mv \\'$directory\\' \\'$artistdir\\ - $album\\'\done}