title: How can I scrape file names and create directories for each filename in Python?
body: <p>I'm trying to scrape filenames inside a folder and then make directories for each filename inside another folder. This is what I've got so far but when I run it, it doesn't create the new folders in the destination folder. When I run it in the terminal it doesn't return any errors.</p>
  
  <pre><code>import os
  import shutil
  
  folder = "/home/ro/Downloads/uglybettyfanfiction.net/"
  destination = "/home/ro/A Python Scripts/dest_test/"
  
  # get each files path name
  
  def ensure_dir(f):
      d = os.path.dirname(f)
      if not os.path.exists(d):
          os.makedirs(d)
  
  for files in os.listdir(folder):
      new_path = folder + files
      ensure_dir(new_path)
  </code></pre>