title: Rename all files in folder with Python
body: <p>Good afternoon. I have 500 pictures (*.jpg) with bad filenames. I want to rename all the files to 01, 02, and so on. Where did I make a mistake?</p>
  
  <pre><code>i = 0
  path="D:/data"
  for filename in os.listdir(path):
        my_dest ="0" + str(i) + ".jpg"
        my_source = path + filename
        # rename all the files
        os.rename(my_source, my_dest)
        i += 1
  </code></pre>