diff options
-rwxr-xr-x | musicSorter.sh | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/musicSorter.sh b/musicSorter.sh new file mode 100755 index 0000000..cf65400 --- /dev/null +++ b/musicSorter.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +count=0 +files="${1}/*.mp3" +for file in $files; do + count=$(($count+1)) + echo "File $count: $file" >> "$1/filelist.txt" + artist=$(tagmp3 show "$file" | grep "Artist" | cut -d' ' -f7- | xargs) + if [ -n "$artist" ]; then + if [ -z "$(ls $1 | grep "$artist")" ]; then + mkdir -p "$1/$artist" + fi + target="$1/$artist/$(basename "$file")" + mv -f "$file" "$target" + fi +done |