SYS_GetDirContents Function


Returns information about the files in a directory.


lfInfo = SYS_GetDirContents ([sDrive[,datasetsizes]])
Variable Description
lfInfo The returned information about the files. LIST OF FILEINFO.
sDir Optional: The name (including path and drive information if required) of the directory to find information about. The default is the current directory. STRING.

Optional: The default is DS_BYTES; other values are DS_KILOBYTES, DS_MEGABYTES, DS_GIGABYTES, or DS_TERABYTES. This parameter affects what iSize in FILEINFO data type returns and whether it is an INTEGER or REAL.

The value returned for DS_BYTES is an integer. If the file size is greater than 2 gigabytes, the return will be 2 gigabytes (though in reality, the file size is greater than that). All other values for datasetsizes return a REAL of the actual file size.


  • SYS_GetDirContents returns information about each of the files in the specified directory, in a record of type FILEINFO. See the FILEINFO data type for a list of fields for FILEINFO.

  • SYS_GetDirContents returns only information that is accessible to the current user. Therefore it returns the contents of only those directories to which the current user has access.

Windows Platforms

SYS_GetDirContents is executed by the Agent process, not the Silk Test Classic process. To affect the host process, use the function with the hHost notation or machine handle operator. For more information about the machine handle operator and hHost, see Machine handle operator.


[ ] INTEGER iCount
[ ] lfFiles = SYS_GetDirContents ()
[-] for iCount = 1 to ListCount (lfFiles)
	[ ] Print (lfFiles[iCount].sName)