Skip to content

Instantly share code, notes, and snippets.

Created December 8, 2012 00:46
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 anonymous/4237869 to your computer and use it in GitHub Desktop.
Save anonymous/4237869 to your computer and use it in GitHub Desktop.
#!/usr/bin/ruby
require 'taglib'
Dir.foreach("/home/music/") do |filename|
# Load a file
TagLib::FileRef.open (filename) do |fileref|
tag = fileref.tag
File.rename ( "/home/music/#{filename}","/home/music/#{tag.title}-#{tag.artist}.mp3")
end
end # File is automatically closed at block end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment