Bug 7176

get the list of files in a given directory. NOT DIRLIST 09 October, 2021

mike S
25 August, 2021
Product: PowerBuilder Category: PowerScript
Version: 2021 Build: 2703
Classification: Unsupported Publishing: Public
Priority: P3
Status: Verifying Reason:
Communication Status: Waiting for Customer
Ken Guo @Appeon 09 October, 2021
Hi Mike,

We’ve discussed this issue internally within our company. The final decision is that we are not planning to support this feature in the near future. However, we will still record it in our internal enhancement request system for future considerations. 

In the meantime, we will close this ticket as unsupported. Thanks for your understanding!

Roland Smith 26 August, 2021
The built in DirList is a ListBox function plus it changes the current directory, two reasons not to use it. I have a windows api example on my website that does this. I think it would be a good idea to have a file system object with a bunch of commonly needed functions. Even VBScript has one.
Aleš Plesničar 26 August, 2021
Hi Mike,

PFC has what you need, of_DirList ...

instancename.of_DirList ( filespec, filetype, dirlist )

 Instance name of n_cst_filesrv
 String specifying the path and file specification (including wildcards) to the directory containing the files to be listed. If you do not specify an absolute path, this function searches relative to the current working directory
 Long specifying one or more types of files to return. Types are:

· 0—Read/write files

· 1—Read-only files

· 2—Hidden files

· 4—System files

· 16—Subdirectories

· 32—Archive (modified) files

· 16384—Drives

· 32768—Exclude read/write files from the list
 Array of type n_cst_dirattrib into which the function places information for the requested files (passed by reference)


Return value 

Long. Returns the number of elements in the dirlist array if the function succeeds and -1 if an error occurs.

Even if you do not use PFC, you can get source from its repository.

Ken Guo @Appeon 26 August, 2021
Hi Mike,

We will submit this ticket to our development to further analyze the issue. It will take some time to reach a conclusion. We will keep you updated!


Chris Pollach @Appeon 25 August, 2021
Hi Mike;

  Thank you for that enhancement suggestion! Yes, this has been a PB enhancement request to PowerSoft, Sybase and SAP for quite some time. The recommended change was (if I remember correctly) would be to have the DirList() command overloaded to also propagate a String Array of file names vs load these into a visual object.

  I will now mark and transfer this ticket to the main Support / Engineering team as an enhancement request.

Regards ... Chris
mike S 25 August, 2021
developers need a way to get a list of files in a directory.  This was pushed off by sybase, then sap.
DIRLIST is NOT the answer - it loads up a VISUAL listbox.  

*Reproduce Steps:

I'm not looking for a workaround to have it work in PB 2021.  i am looking for this to be added as a feature.  It should return an array of filenames, or maybe a tab delimited list.  something that does not require a visual object to work.

and yes, i can drop down to window api and write my own,  but this is core functionality and should have been added
Database Type:
Database Version: