title: Python not recognising directories os.path.isdir()
body: <p>I have the following Python code to remove files in a directory.
  For some reason my .svn directories are not being recognised as directories.</p>
  
  <p>And I get the following output:</p>
  
  <blockquote>
    <p>.svn not a dir</p>
  </blockquote>
  
  <p>Any ideas would be appreciated.</p>
  
  <pre><code>def rmfiles(path, pattern):
      pattern = re.compile(pattern)
      for each in os.listdir(path):
          if os.path.isdir(each) != True:
              print(each +  " not a dir")
              if pattern.search(each):
                  name = os.path.join(path, each)
                  os.remove(name)
  </code></pre>