All pastes #983288 Raw Edit

Mine

public shellscript v1 · immutable
·published 2008-04-13 06:39 UTC
rendered paste body
#!/bin/bash# Script By Robert Navarro# crshman [at] gmail.com## Rename/Moves MP3 files based on# id3v2 tagsLIVE=## Set to some value for live operation# ex# $LIVE=Yes# the script will move files around## $LIVE=# the script won't move anything aroundPRE_DEST='/media/Data/Share/Music/'# Local directory to move files tofor file in *.mp3; doif [ -e $file ]; thenTRACK="`id3v2 -l "$file" | grep TRCK | awk '{ for (i=6;i<=NF;i++) { printf $i; printf " " } }'`"# Track NumberSP_YEAR="`id3v2 -l "$file" | grep TYER | awk '{ for (i=3;i<=NF;i++) { printf $i; printf " " } }'`"YEAR=${SP_YEAR:0:$((${#SP_YEAR}-1))}# Track YearSP_ARTIST="`id3v2 -l "$file" | grep TPE1 | awk '{ for (i=4;i<=NF;i++) { printf $i; printf " " } }'`"ARTIST=${SP_ARTIST:0:$((${#SP_ARTIST}-1))}# Track ArtistFIRST_ARTIST=${ARTIST:0:1}# First Letter of the Artist of the TrackSP_ALBUM="`id3v2 -l "$file" | grep TALB | awk '{ for (i=4;i<=NF;i++) { printf $i; printf " " } }'`"ALBUM=${SP_ALBUM:0:$((${#SP_ALBUM}-1))}# Track AlbumSP_TITLE="`id3v2 -l "$file" | grep TIT2 | awk '{ for (i=4;i<=NF;i++) { printf $i; printf " " } }'`"TITLE=${SP_TITLE:0:$((${#SP_TITLE}-1))}# Track TITLE#Edit these to reflect your preferencesFOLDER="$PRE_DEST$FIRST_ARTIST/$ARTIST/$ALBUM ($YEAR)"DEST="$FOLDER/$TRACK - $TITLE.mp3"#echo $file#echo $FOLDER#echo $DEST#echo -e "\n"if [ $LIVE ]; thenmkdir -p "$FOLDER"mv "$file" "$DEST"fifidone