I\'m trying to sort all mp3 files by artist and name. At the moment, they\'re in 1 giant file name. E.g Artist - Song name.mp3 I want to convert this to Artist/Song name.mp
Just in case you don't have the rename
utility. A fix on your original script.
for f in *.mp3; do
# extract artist and song name and remove spaces
artist=${f%% -*}
song=${f##*- }
#make directory with the extracted artist name and move + rename the file into the directory
echo mkdir -p -- "$artist" && echo mv -- "$f" "$artist/$song"
done
echo
If you're satisfied with the output.