ADIR()* Fill a series of arrays with directory information ------------------------------------------------------------------------------ Syntax ADIR([<cFilespec>], [<aFilenames>], [<aSizes>], [<aDates>], [<aTimes>], [<aAttributes>]) --> nFiles Arguments <cFilespec> is the path specification of files to include in the scan of the DEFAULT directory. It is a standard file specification that can include the wildcard characters * and ?, as well as a drive and path reference. If omitted, the default specification is *.*. <aFilenames> is the array to fill with the file names matching <cFilespec>. Each element contains the file name and extension as a character string in all uppercase letters. <aSizes> is the array to fill with the sizes of the corresponding files in the <aFilenames> array. Each element is a numeric data type. <aDates> is the array to fill with the dates of the corresponding files in the <aFilenames> array. Each element is a date data type. <aTimes> is the array to fill with the times of the corresponding files in the <aFilenames> array. Each element filled contains a character string of the form: hh:mm:ss. <aAttributes> is the array to fill with attributes of the corresponding files in the <aFilenames> array. Each element is a character string. If <aAttributes> is specified, hidden, system, and directory files are included as well as normal files. If <aAttributes> is not specified, only normal files are included. Returns ADIR() returns the number of files matching the directory skeleton described in <cFilespec>. Description ADIR() is an array function that performs two basic operations. First, it returns the number of files matching the file specification. Second, it fills a series of arrays with file names, sizes, dates, times, and attributes. ADIR() is a compatibility function and therefore not recommended. It is superseded by the DIRECTORY() function which returns all file information in a multidimensional array. Notes . Directories: If you specify the <aAttributes> argument and <cFilespec> is *.*, directories will be included in <aFilenames>. In the <aAttributes> array, directories are indicated with an attribute value of "D". If ADIR() is executed within a subdirectory, the first two entries of the <aFilenames> array are "." and "..", the parent and current directory aliases. The date and time of last update are reported for directories, but the size of a directory is always zero. Examples . This example creates an array to hold the names of all .txt files in the current DEFAULT directory, then uses AEVAL() to list them to the console: LOCAL aFiles[ADIR("*.TXT")] ADIR("*.TXT", aFiles) AEVAL(aFiles, { |element| QOUT(element) }) Files Library is EXTEND.LIB.
See Also: ACHOICE() AEVAL() ASCAN() ASORT() DIRECTORY()