title: Rename file name in python
body: <p>Im looking to rename a file which is always export(x).csv but the x can be a random number.</p>
  <p>Id like to rename it with the date format YYYYMMDDHHMM.csv</p>
  <pre><code>import os
  
  old_file = os.path.join(&quot;c:\&quot;, &quot;export%&quot;)
  
  new_file = os.path.join(&quot;c:\&quot;, &quot;YYYYMMDDHHMM.csv&quot;)
  
  os.rename(old_file, new_file)
  </code></pre>