devxlogo

Getting All Files in a Directory

Getting All Files in a Directory

Question:
How do I loop through a window’s subdirectory and get all the files one by one? I need to save each file in a specific format before saving it to a database.

Answer:
The PowerBuilder list box object has functions that will load the contents of a directory into the list box. You can specify whether you want files, directories, or both.

By requesting all directories first, and then files, you can recursively call the function to get all the files in the subdirectories.

devx-admin

Share the Post: