Skip to content

Instantly share code, notes, and snippets.

@bensonk
Created August 24, 2011 07:24
Show Gist options
  • Select an option

  • Save bensonk/1167484 to your computer and use it in GitHub Desktop.

Select an option

Save bensonk/1167484 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
import ID3, os
for fname in [ x for x in os.listdir(".") if x.lower().endswith(".mp3") ]:
print "handling: %s" % fname
tag = ID3.ID3(fname)
new_name = "%0.2d %s.mp3" % (tag.track, tag.title)
if fname and tag and new_name:
os.rename(fname, new_name)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment