Created
September 5, 2012 19:10
-
-
Save FernandoEscher/3642776 to your computer and use it in GitHub Desktop.
Renaming the folders generated by abcde CD ripper
This file contains 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 | |
SEPARATOR="-" | |
DIRS="${PWD}/*" | |
for dir in $DIRS | |
do | |
if [[ -d $dir && $dir == *-* ]] | |
then | |
dirname=$(basename $dir) | |
artist=${dirname%-*} | |
artist=${artist//_/ } | |
album=${dirname##*-} | |
album=${album//_/ } | |
echo "Found artist \"$artist\" with album \"$album\"" | |
if [ ! -d "${PWD}/$artist" ] | |
then | |
echo "Creating directory \"$artist\"" | |
mkdir "${PWD}/$artist" | |
fi | |
mv $dir "${PWD}/$artist/$album" | |
echo "Moved to $artist/$album/" | |
fi | |
done | |
echo "Done!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment