title: I don't think I understand Os.walk fully
body: <p>I've been trying to build a program for work that deletes unneeded files generated by a software when we export stills. </p>
  
  <p>I was quite happy with how it's working. You just drop a folder that you want and it will delete all the files in that folder. But my boss saw me using it and asked if he could just drop the top directory folder in and it would go into each folder and delete the DRX to save him time of doing it manually for each folder. </p>
  
  <p>This is my current program - </p>
  
  <pre><code>#!/usr/bin/env python3
  import os
  import sys
  import site
  import threading
  import time
  from os import path 
  from os import listdir
  from os.path import isfile, join
  
  
  while True:
      backboot = 'n'
      while backboot == 'n':
  
          print ("")
          file = (input("Please drag and drop the folder containing DRX files you wish to delete : "))
          path = file[:-1]
          os.chdir(path)
          drx = [x for x in os.listdir() if x.endswith(".drx")]
          amount = (str(len(drx)))
  
          print("")
          print("")
          print("")
          print ('I have found ' + amount + ' files with the .drx extension and these will now be deleted')
          print("")
          print("")
          print(*drx,sep='\n')
          print("")
          print("")
          print("")
          exts = ('.drx')
  
  
          for item in drx:
                  if item.endswith(".drx"):
                      os.remove(item)
  
          print ('Deleted ' + amount + ' files.')
          print('')
  </code></pre>
  
  <p>What I understand about <code>OS.walk</code> it's generating the <code>trees</code> or folders in a given directory by going up or down the tree. So far, I have the user's input for a path location - </p>
  
  <pre><code>file = (input("Please drag and drop the folder containing DRX files you wish to delete : "))
          path = file[:-1]
          os.chdir(path
  </code></pre>
  
  <p>I then scan that directory for <code>DRX files</code> </p>
  
  <pre><code>drx = [x for x in os.listdir() if x.endswith(".drx")]
  </code></pre>
  
  <p>and turn that into a string as well in order to tell the user how many files I found. </p>
  
  <pre><code>amount = (str(len(drx)))
  </code></pre>
  
  <p>So, I'm guessing, would I need to implement the OS.walk before or during the DRX scan? Would this be better done whit a function? I'm just trying to wrap my head around <code>OS.walk</code> so any help would be amazing. :) </p>
  
  <p>I guess, I'm quite stuck on how to get <code>OS.walk</code> to read my path variable. </p>
  
  <pre><code>for root, dirs, items in os.walk(path):
  </code></pre>