summaryrefslogtreecommitdiff
path: root/sortsongs
blob: 510af260d63e4bc465e3c27f19120e566936000e (plain)
1
2
3
4
5
6
7
8
9
10
#!/sbin/sh

ls *.mp3 | while read i; do
  DATA="$(gettags "$i")"
  ARTIST=$(echo "$DATA" | cut -d'|' -f2)
  ALBUM=$(echo "$DATA" | cut -d'|' -f1)
  [ ! -d "$ARTIST"/"$ALBUM" ] && mkdir -p "$ARTIST"/"$ALBUM"
  mv "$i" "$ARTIST"/"$ALBUM"/.
  echo "$i"
done