title: how to rename files to sub directory
body: <p>I am trying to rename  all my .wav files in my sub directory with a tag of sub directory they are present in. Fox example 
  <strong>directory/sub-directory1/ 1_1.wav</strong> to <strong>directory/sub-directory1/ sdir1_1.wav</strong> . I know how to rename files in python but I cannot loop through the subdirectory and then add the tag.
  although the code below works to align sub dir and files but it wont loop through all the files because <code>for dire in dirs:</code> will not work if the files are more than the dirs</p>
  
  <pre><code> import os
  
      rootdir = r'C:\Users\test'
  
      for subdir, dirs, files in os.walk(rootdir):
  
          for dire in dirs:
            for file in files:
             filepath = subdir+os.sep+file
  
             if filepath.endswith('.wav'):
               print (dire+ file) 
  </code></pre>