FindFiles

The FindFiles function returns a string matrix with file names and other file information.

smFiles = FindFiles(ssMatch)

Return Value

smFiles is a string matrix with three columns. If the function could not find any files, an empty string is returned (“”).

Value Meaning
smFiles[;1] The first column contains the complete file names.
smFiles[;2] The second column contains the file size in bytes.
smFiles[;3] The third column contains the file attributes (see GetFileAttributes).

Parameters

ssMatch

The ssMatch parameter may use wildcards (* and ?). Example: "c:/*.xls".

Example

The following functions returns the names of all sub directories.

def GetDirNames(ssDir)
{
   smInfo = FindFiles(ssDir + "/*");
   rvAttrib = strtod(smInfo[;3]);
   idx = find(rvAttrib & 16);
   if (idx[1] != 0) {
       svDir = smInfo[idx;1];
       // remove "." and ".."
       idx = find(svDir != "." && svDir != "..");
       if (idx[1] != 0) {
          return svDir[idx]';
       }
  }
  return "";
}

id-4577