Automating QTP Test Automation Home Automation Articles Downloads QTP Gotchas Links Books Contact About Site Map
File Function - Get All FoldersThis function loads an array with a complete of all the folders on the local machine. Download it Here (right-click and then save target as). (NOTE - you can just cut & paste from below, but the formatting will have multiple spaces instead of tabs).
'=========================================================================
Function xFile_GetAllFolders Dim oWMIService, oFolders, oFolder, iFolderCount, asFolders() iFolderCount = 0 Set oWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2") Set oFolders = oWMIService.ExecQuery("Select * from Win32_Directory") For Each oFolder in oFolders ReDim Preserve asFolders(iFolderCount) asFolders(iFolderCount) = oFolder.Name iFolderCount = iFolderCount + 1 Next xFile_GetAllFolders = asFolders End Function '========================================================================= |