dideler
8/28/2012 - 8:58 PM

Renaming files in a folder consecutively.

Renaming files in a folder consecutively.

import os

for i, filename in enumerate(sorted(os.listdir("."))):
  os.rename(filename, "{0}.png".format(i))