drrnnn drrrnnnn

July 11
-----------------------------------------------------------------
+

Bash-fu

To put the track number in front of the filename of a bunch of songs, based on the order in a playlist:

j=1; for i in `cat playlist.m3u |grep mp3`; do echo mv "$i" "`printf %02d $j` $i"; j=$((j+1)); done

(make sure you don’t have spaces in the filename or that your IFS is set to only newline, by doing IFS=”<press enter>”)

There are probably nice tools to do this and it can be done based on the ID3 tags if they’re present, but this works just as well.