title: I want my x folder with the y.png files to take the name of z.png
body: <p>you will find my code i am not python pro but i do everything to become it</p>
  
  <pre><code>import os, sys
  os.listdir(os.getcwd())
  
  
  Out[3]: ['.ipynb_checkpoints',
           'helmet_10_0.png',
           'helmet_10_1.png',
           'helmet_10_10.png',
  
  I wish
  
  Out[0]: ['casque_Chantier_10_0.png',
           'casque_Chantier_10_10.png',
           'casque_Chantier_10_100.png'
  </code></pre>
  
  <p>so on</p>
  
  <pre><code>
  source = 'D:\\Chasse_Au_tressor\\base_agmt\\extractedFrames_step_5\\helmet_10_0.png'
  
  
  dest = 'D:\\Chasse_Au_tressor\\base_agmt\\extractedFrames_step_5\\Casque_Chantier_10_0.png'
  
  os.rename(source, dest)
  Out[2]: ['casque_Chantier_10_0.png',
           'helmet_10_1.png',
           'helmet_10_10.png',
           'helmet_10_100.png',
           'helmet_10_101.png',
  
  </code></pre>
  
  <p>I can't make a loop which takes all the files with 'glob' and renames them</p>
  
  <pre><code>&lt;ipython-input-33-1a271eebe4a0&gt; in &lt;module&gt;
        1 for i in source:
        2     if i != dest:
  ----&gt; 3         os.rename(i,dest)
  
  FileNotFoundError: [WinError 2] Le fichier spécifié est introuvable: 'D' -&gt; 'D:\\Chasse_Au_tressor\\base_agmt\\extractedFrames_step_5\\Casque_Chantier_{*}.png'
  
  </code></pre>
  
  <p>I want the images on casque_Chantier_{index=1}.png</p>