Created
May 8, 2012 13:37
-
-
Save daniel-san/2635072 to your computer and use it in GitHub Desktop.
Script for organizing a music directory
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#Script for organize a directory of songs | |
#This script create directory for song authors, sub-directories for albums | |
#and copy the respective album songs to the respective directory | |
a=`ls *.mp3 | cut -d "-" -f 1 | uniq` | |
#mkdir $a | |
for i in $a | |
do | |
#echo $i | |
mkdir $i | |
b=`ls *.mp3 | grep $i | cut -d "-" -f 2 | uniq` | |
for j in $b | |
do | |
mkdir $i/$j | |
c=`ls *.mp3 | grep $j` | |
for k in $c | |
do | |
d=`echo $k | grep $j | cut -d "-" -f 3 | uniq` | |
cp $k $i/$j/$d | |
done | |
done | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment