问题
How can i get list of files in a directory programatically in foxpro?
回答1:
ADIR() -- create an array based on a directory using whatever wildcard...
local array MyFiles[1,5]
nFilesFound = ADIR( MyFiles, "C:\Somepath\*.dbf" )
for i = 1 to nFilesFound
? "Name Of File: ", MyFiles[ i, 1]
? "Size: ", MyFiles[ i, 2]
*/ i,3 = date... i,4 = time, i,5 = attributes
endfor
回答2:
You can also use the File System Object to get more information:
fso=createobject("scripting.filesystemobject")
fld=fso.getfolder(lcFolderName)
for each fil in fld.files
?"Name Of File: ", fil.name
?"Size: ", fil.size
?"Date created:", fil.DateCreated
?"Last modified:", fil.DateLastModified
next
来源:https://stackoverflow.com/questions/6483215/get-list-of-files-in-a-directory-in-foxpro