title: How to rename all files in a folder and create a renaming map
body: <p>Note: I have access to both Linux and Windows platform so answers for any of these platforms are fine.</p>
  
  <p>I have a folder which contains less than 10K .png files. I would like to:</p>
  
  <pre><code>1. rename all files as follows:
  
      &lt;some_filename&gt;.png to 0001.png
      &lt;some_other_name&gt;.png to 0002.png
      &lt;another_name&gt;.png to 0003.png
      and so on...
  
  2. keep this name mapping in a file (see 1 for mapping)
  </code></pre>