Enumerates all the files on a computer. This is a demonstration script; if actually run, it could take an hour or more to complete, depending on the number of files on the computer. Depending on the number of files and on available memory, this script could also fail before finishing.

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

Python
Edit|Remove
import win32com.client
strComputer = "."
objWMIService = win32com.client.Dispatch("WbemScripting.SWbemLocator")
objSWbemServices = objWMIService.ConnectServer(strComputer,"root\cimv2")
colItems = objSWbemServices.ExecQuery("Select * from CIM_DataFile")
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 "Manufacturer: ", objItem.Manufacturer
    print "Name: ", objItem.Name
    print "Path: ", objItem.Path
    print "Readable: ", objItem.Readable
    print "Status: ", objItem.Status
    print "System: ", objItem.System
    print "Version: ", objItem.Version
    print "Writeable: ", objItem.Writeable