n=adir(lal_array,'d:\downvfp\*.*')
?n
for i=1 to n
?lal_array(i,1)
endfor
Places information about files into an array and then returns the number of files.
Syntax
ADIR(ArrayName [, cFileSkeleton [, cAttribute]])
Returns
Numeric
Arguments
ArrayName Specifies the name of the array. If the array you include doesn exist, Visual FoxPro automatically creates the array. If the array exists and isn large enough to contain all the information, Visual FoxPro automatically increases the size of the array to accommodate the information. If the array is larger than necessary, Visual FoxPro truncates the array. If the array exists and ADIR( ) returns 0 because no matching files are found, the array remains unchanged. If the array doesn exist and ADIR( ) returns 0, the array isn created.
The following table describes the contents and data type of each column in the array:
Column Array contents Data type
1 File names Character
2 File sizes Numeric
3 Dates last modified Date
4 Times last modified Character
5 File attributes Character
The last array column contains the file attributes of the matching files. Each file attribute is expressed by a letter; a file can have more than one attribute. The following table indicates the file attribute represented by each letter:
Letter Attribute
A Archive - Read/Write
H Hidden
R Read-only
S System
D Directory or folder
cFileSkeleton Specifies a file skeleton so you can store information about files with names or extensions that match a search criterion. For example, the criterion can be all tables, all text files, all files with names that have A as their first letter, and so on. Such general searches are done by including the wildcards * and ? in cFileSkeleton. A question mark represents a single character; an asterisk represents any number of characters. You can use any number of wildcards in any position within the file skeleton.
You can specify a drive and/or directory to search in for matching file names. If you don specify a drive and directory, Visual foxPro places information about files in the current directory into the array.
cAttribute Specifies the inclusion of subdirectories and hidden or system files.
cAttribute can contain any combination of D, H, and S. Including D returns subdirectory names of the current directory in addition to file names that match the file skeleton specified in cFileSkeleton. Including H returns information about hidden files that match the file skeleton specified in cFileSkeleton. Including S returns information about system files that match the file skeleton specified in cFileSkeleton.
Include an empty string in cFileSkeleton to return just subdirectory names, hidden files or system files.
Remarks
For each file, ADIR( ) places into the array the file name, size, date last modified, time last modified, and attributes.