title: Deleting hidden directories?
body: <p>I have a directory where there can be <code>.unwanted</code> directories anywhere within the directory tree. I want these deleted.</p>
  
  <pre><code>import shutil
  shutil.rmtree('.unwanted', onerror=True)
  </code></pre>
  
  <p>This does not work because the directories are hidden. Output:</p>
  
  <pre><code>Traceback (most recent call last):
    File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\shutil.py", line 374, in _rmtree_unsafe
      with os.scandir(path) as scandir_it:
  FileNotFoundError: [WinError 3] The system cannot find the path specified: '.unwanted'
  
  During handling of the above exception, another exception occurred:
  
  Traceback (most recent call last):
    File "D:/SYSTEM/CODING/PYTHON/import.py", line 31, in &lt;module&gt;
      shutil.rmtree('.unwanted', onerror=True)
    File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\shutil.py", line 516, in rmtree
      return _rmtree_unsafe(path, onerror)
    File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\shutil.py", line 377, in _rmtree_unsafe
      onerror(os.scandir, path, sys.exc_info())
  TypeError: 'bool' object is not callable
  
  Process finished with exit code 1
  </code></pre>
  
  <p>Nevermind the line numbers, the sample code is from a larger script.</p>