title: Getting folder name
body: <p>I iterate over a bunch of folders and files in the folders, doing this:</p>
  
  <pre><code>def get_files_in_directory(directory=rootDirectory):
      for root, dirs, files in os.walk(directory, topdown='true'):
          print("root %s dirs %s files %s" %(root, dirs, files));
          for file in files:
              ext = os.path.splitext(file)[-1].lower();
              if (ext == '.mod'):
                  print(file);
  </code></pre>
  
  <p>When I print the file, I would like to also print the relative name of the dir that contains it. </p>
  
  <p>So if I have</p>
  
  <pre><code>C:\\myfolderA\\myFolderB\\myFile.MOD
  </code></pre>
  
  <p>I just get</p>
  
  <pre><code>myFolderB
  </code></pre>
  
  <p>I don't want</p>
  
  <pre><code>C:\\myFolderA\\myFolderB 
  </code></pre>
  
  <p>which of course I can get from the dir variable</p>