Function ADir() Foundation

Fills a set of arrays with information about a directory.

Syntax
ADir( [<cFileSpec>], ;
      [<aFileName>], ;
      [<aFileSize>], ;
      [<aFileDate>], ;
      [<aFileTime>], ;
      [<aFileAttr>]  ) --> nFileCount
Parameters
<cFileSpec>
<cFileSpec> is a character string specifying the drive, path and file from which file information is read into an array. A file mask can be defined by using "wildcards" (* or ?) as part of the file name. If no <cFileSpec> is specified, "*" is used (default for the HPFS file system), and all file information in the current path is read. If the Xbase++ program is running on a FAT file system and all files in the current path are to be listed, then "*.*" must be specified as the file.
<aFileName>
<aFileName> is an array into which the names of the files in the directory are placed. Each element of <aFileName> contains a character string.
<aFileSize>
<aFileSize> is an array into which the size of the files are placed. Each element of <aFileSize> contains a numeric value.
<aFileDate>
<aFileDate> is an array into which the date of the files are placed. Each element of <aFileDate> contains a date value.
<aFileTime>
<aFileTime> is an array into which the time of the files are placed. Each element of <aFileTime> contains a character string with the country specific time format defined in the system settings.
<aFileAttr>
<aFileAttr> is an array into which the attributes of the files are placed. Each element of <aFileAttr> contains one ore more of the following letters: "D","A","R","S","H". If <aFileAttr>is specified hidden files and system files may be detected.
Return

The return value of ADir() is a positive integer corresponding to the number of files which where found matching <cFileSpec>.

Description

The function ADir() exists only for compatibility reasons. Instead of ADir(), the function Directory() should be used. Directory() returns the file information in a two dimensional array.

The environment function ADir() places information about the files of an directory file into a set of arrays. First only <cFileSpec>is passed to the function in order to determine the number of matching files. This number is used to dimension the set of arrays to be filled in a second call to ADir().

Examples
ADir()
// The example generates an array, fills it with names of 
// DBF files located in a specific sub-directory and then displays 
// the information. 

PROCEDURE Main 
   LOCAL aFileNames, nCount 

   nCount     := ADir( "\xpp\samples\data\misc\*.dbf" ) 
   aFileNames := Array( nCount ) 

   ADir( "\xpp\samples\data\misc\*.DBF", aFileNames ) 

   AEval( aFileNames, { |cFileName| QOut(cFileName)} ) 

RETURN 

Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.