dirExt( )
Topic group Related topics Example
dirExt( ) is an extended version of the dir( ) method. It fills the array with nine characteristics of specified files: name, size, modified date, modified time, file attribute(s), short (8.3) file name, create date, create time, and access date. Returns the number of files whose characteristics are stored.
Syntax
<oRef>.dirExt([<filename skeleton expC> [, <file attribute list expC>]])
<oRef>
A reference to the array in which you want to store the file information. dirExt( ) will automatically redimension or increase the size of the array to accommodate the file information, if necessary.
<filename skeleton expC>
The file-name pattern (using wildcards) describing the files whose information you want to store to <oRef>.
<file attribute list expC>
The letter or letters D, H, S, and/or V representing one or more file attributes.
If you want to specify a value for <file attribute expC>, you must also specify a value or "*.*" for <filename skeleton expC>.
The meaning of each attribute is as follows:
Character |
Meaning |
D |
Directories |
H |
Hidden files |
S |
System files |
V |
Volume label |
If you supply more than one letter for <file attribute expC>, include all the letters between one set of quotation marks, for example, aFiles.dirExt("*.*", "HS").
Property of
Array
Description
Use dirExt( ) to store information about files to an array, which is dynamically resized so all returned information fits in the array. The resulting array is always a two-dimensional array, unless there are no files, in which case the array is not modified.
Without <filename skeleton expC>, dirExt( ) stores information about all files in the current directory, unless they are hidden or system files. For example, if you want to return information only on DBF tables, use "*.DBF" as <filename skeleton expC>.
If you want to include directories, hidden files, or system files in the array, use <file attribute expC>. When D, H, or S is included in <file attribute expC>, all directories, hidden files, and/or system files (respectively) that match <filename skeleton expC> are added to the array.
When V is included in <file attribute expC>, dirExt( ) ignores <filename skeleton expC> as well as other characters in the attribute list, and stores the volume label to the first element of the array.
dirExt( ) stores the following information for each file in each row of the array. The data type for each is shown in parentheses:
Column 1 |
Column 2 |
Column 3 |
Column 4 |
Column 5 |
File name |
Size |
Modified date |
Modified time |
File attribute(s)
|
Column 6 |
Column 7 |
Column 8 |
Column 9 |
Short (8.3) file name (character) |
Create date |
Create time |
Access date
|
Column 5 (file attribute) can contain one or more of the following file attributes, in the order shown:
Attribute |
Meaning |
R |
Read-only file |
A |
Archive file (modified since it was last backed up) |
S |
System file |
H |
Hidden file |
D |
Directory |
If the file has the attribute, the letter code is in the column. Otherwise, there is a period. For example, a file with none of the attributes would have the following string in column 5:
.....
A read-only, hidden file would have the following string in column 5:
R..H.
Use dir( ) to get basic file information only.