title: Using Win32 api from python
body: <p>Following code has been given in the activestate python help file. This code is for recursively deleting a files in folder followed by deleting the folder itself. Please point out the error in it because I want to use win32 api using python</p>
  
  <pre><code>import win32con
  import win32api
  import os
  
  def del_dir(path):
      for file_or_dir in os.listdir(path):
          if os.path.isdir(file_or_dir) and not os.path.islink(file_or_dir):
              del_dir(file_or_dir) #recursive call to function again
          else:
              try:
                  os.remove(file_or_dir) #it's a file,delete is
              except:
                  #probably failed because it is not a normal file
                  win32api.SetFileAttributes(file_or_dir,win32con.FILE_ATTRIBUTE_NORMAL)
                  os.remove(file_or_dir) #it's a file delete it
  
          os.rmdir(path)#delete the directory here
  </code></pre>