hi,
habe folgendes script gemacht, welches verzeichnisses von mp3s umbenennen soll auf basis von id3-tags.
#/bin/bash find "$@" -mindepth 3 -type d | while read dir do artistdir=$(dirname "$dir") firstfile=$(find "$dir" -type f -iname '*.mp3' | head -n1) year=$(id3info "$firstfile" | egrep ' TYER ' | sed 's/[^0-9]*//g') album=$(id3info "$firstfile" | egrep ' TALB ' | sed 's;=== TALB (Album/Movie/Show title): ;;') artist=$(id3info "$firstfile" | egrep ' TPE1 ' | sed 's;=== TPE1 (Lead performer(s)/Soloist(s)): ;;') # mach aus space --> underscore (mit // global substitution) ualbum=$(echo ${album// /_}) uartist=$(echo ${artist// /_}) echo mv -v "'$dir'" "'$artistdir/$year-$uartist-$ualbum'" done
funktioniert grundsaetzlich, allerdings nur wenn man es mit script.sh | sh aufruft (daher auch das echo beim mv).
wenn man das "mv" direkt im script ausfuehren will, bekommt man den error "mv cannot statt". Es liegt wohl daran, dass manche verzeichnis ein blank haben, daher auch die anfuehrungszeichen.
wie gesagt mit dem echo | sh gehts, mv direkt im script leider nicht.
hat jemand eine idee, wie man das loesen kann?
danke & gruss