Returns a list of all the folders on a computer. This can take 15 minutes or more to complete, depending on the number of folders on the computer.

This script was tested using Python 2.2.2-224 for Microsoft Windows, available from ActiveState.

import win32com.client
strComputer = "."
objWMIService = win32com.client.Dispatch("WbemScripting.SWbemLocator")
objSWbemServices = objWMIService.ConnectServer(strComputer,"root\cimv2")
colItems = objSWbemServices.ExecQuery("Select * from Win32_Directory")
for objItem in colItems:
    print "Access Mask: ", objItem.AccessMask
    print "Archive: ", objItem.Archive
    print "Caption: ", objItem.Caption
    print "Compressed: ", objItem.Compressed
    print "Compression Method: ", objItem.CompressionMethod
    print "Creation Class Name: ", objItem.CreationClassName
    print "Creation Date: ", objItem.CreationDate
    print "CS Creation Class Name: ", objItem.CSCreationClassName
    print "CS Name: ", objItem.CSName
    print "Description: ", objItem.Description
    print "Drive: ", objItem.Drive
    print "Eight Dot Three File Name: ", objItem.EightDotThreeFileName
    print "Encrypted: ", objItem.Encrypted
    print "Encryption Method: ", objItem.EncryptionMethod
    print "Extension: ", objItem.Extension
    print "File Name: ", objItem.FileName
    print "File Size: ", objItem.FileSize
    print "File Type: ", objItem.FileType
    print "FS Creation Class Name: ", objItem.FSCreationClassName
    print "FS Name: ", objItem.FSName
    print "Hidden: ", objItem.Hidden
    print "Install Date: ", objItem.InstallDate
    print "In Use Count: ", objItem.InUseCount
    print "Last Accessed: ", objItem.LastAccessed
    print "Last Modified: ", objItem.LastModified
    print "Name: ", objItem.Name
    print "Path: ", objItem.Path
    print "Readable: ", objItem.Readable
    print "Status: ", objItem.Status
    print "System: ", objItem.System
    print "Writeable: ", objItem.Writeable