Skip to content

Instantly share code, notes, and snippets.

@aurelian
Created July 2, 2015 16:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aurelian/e5e47b14471723c77d57 to your computer and use it in GitHub Desktop.
Save aurelian/e5e47b14471723c77d57 to your computer and use it in GitHub Desktop.
# gem "taglib-ruby"
require 'taglib'
require 'fileutils'
folder = "/Users/aurelian/Music/The Gathering/2007 - A Noise Severe"
Dir["#{folder}/**/**"].each do | alot |
TagLib::FileRef.open(alot) do | file |
unless file.null?
tag = file.tag
new_name = sprintf("#{folder}/%02d %s.m4a", tag.track, tag.title)
puts "#{alot}\n\t => #{new_name}"
FileUtils.mv alot, new_name
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment