aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorInigoGutierrez <inigogf.95@gmail.com>2018-12-16 19:24:59 +0100
committerInigoGutierrez <inigogf.95@gmail.com>2018-12-16 19:24:59 +0100
commitdd5dbdb734de3efd177fe4440a9d385d17ee5e8d (patch)
treef1b178f9760800fc0d66d001b342ccc6dd1ac853
parent590e1b8feeab5949cc94dbfb7237676186fc0527 (diff)
downloadscripts-dd5dbdb734de3efd177fe4440a9d385d17ee5e8d.tar.gz
scripts-dd5dbdb734de3efd177fe4440a9d385d17ee5e8d.zip
Created non-working music sorter script.
-rwxr-xr-xmusicSorter.sh16
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