I wrote this little script in Ruby a couple years ago to solve the problem of scrambled mp3’s in a large set of +4000 files. It’s quick dirty, simple, and taglib does all the lifting.

 

#!/bin/ruby
require 'taglib'

path = "your path"

Dir.foreach("#{path}") do |file|
TagLib::MPEG::File.open("#{path}#{file}") do |fileref|
tag = fileref.tag

if file =~ /mp3/
File.rename("#{path}#{file}","#{path}#{tag.title}-#{tag.artist}.mp3")
end
end

end

Advertisements