oops spotted an error..

for file in *jpg
do
ARTIST1=${file#*- }
ARTIST=${ARTIST1%.*}
ALBUM=${file% -*}
echo "###"$ARTIST/$ALBUM
if [[ -d ../Music/$ARTIST/$ALBUM/ ]]
then
mv "$file" ../Music/$ARTIST/$ALBUM/cover.jpg
else
echo $file" could not be moved" >> error.log
fi
done


if you run this script whilst in the "/Users/Myusername/Pictures/"
directory

it will take a file called "1999 - Prince.jpg"  and move it to 
"/Users/Myusername/Music/Prince/1999" and rename it to cover.jpg

if "/Users/Myusername/Music/Prince/1999/" does not exist it will create
a line in error.log and leave the file where it is.

if you wanted to test it with just a small set of files change the
first line to (for eg) for file in 1999*jpg


-- 
wilgartw
------------------------------------------------------------------------
wilgartw's Profile: http://forums.slimdevices.com/member.php?userid=19007
View this thread: http://forums.slimdevices.com/showthread.php?t=51628

_______________________________________________
discuss mailing list
[email protected]
http://lists.slimdevices.com/lists/listinfo/discuss

Reply via email to