Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
WSH and Subfolders of Subfolders
Message
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Title:
WSH and Subfolders of Subfolders
Miscellaneous
Thread ID:
00224547
Message ID:
00224547
Views:
67
Hi all,

I've been experimenting with the FileSystemObject and so far have really liked using it. I am attempting to get a list of filenames contained in certain folders, including subfolders that are several levels deep from the root folder. The code below works okay for getting the first level of files, but what modifications do I need to make to get ALL files contained on a particular drive/folder, including any files nested within multiple layers of subfilders? Any help is appreciated.

The following code is a sample of what I'm working with so far (In my actual code, I am storing the filename and its complete path in a table rather than using a wait window to display it to the screen!):

oFileSystem=CREATEOBJECT("scripting.filesystemobject")
IF oFileSystem.FolderExists('C:\')
oFolder=oFileSystem.GetFolder('C:\')
FOR EACH oSubFolder in oFolder.SubFolders
FOR EACH oFile in oSubFolder.Files
WAIT WINDOW oFile.Name TIMEOUT 1
ENDFOR
ENDFOR
ENDIF

Thanks,
Next
Reply
Map
View

Click here to load this message in the networking platform