title: How can I get this script to check every file in the directory BUT not record each individual check?
body: <p>I've been tweaking this script I use for work to try and make it more user friendly to people besides myself. Here's the snippet that's giving me a bit of trouble.</p>
  
  <pre><code>def depdelete(path):
  
      for path, dirs, files in os.walk(path):
          for f in files:
              if f.endswith('.exe'):
                  os.remove(os.path.join(path, f))
                  print('Dep Files have been deleted from' + path)
                  with open(completeName, 'a') as ddr:
                      ddr.write('Dep Files have been deleted from' + path + '. \n')
              else:
                  print('No Dep Files found in' + path)
                  with open(completeName, 'a') as ddr:
                      ddr.write('No Further Dep Files found in' + path + '. \n')
  </code></pre>
  
  <p>Now, the script works as intended. Files are deleted and recorded correctly. However, in its current state the Else statement runs for every file in the path, resulting in repeated entries of "No Further Dep Files found in...".</p>
  
  <p>I'd like to change this so that it checks each file, but after checking the whole file, only records one instance of "No Further Dep Files found in..."</p>
  
  <p>Basically, how can I make this <em>check</em> every file in the directory, but only record "No Further Dep Files found in..." once, after each file has been checked.</p>
  
  <p>Kind of blanking right now, with a "on the tip of my toungue" feeling. Tips?</p>