如何在foxpro中以编程方式获取目录中的文件列表?
答案 0 :(得分:13)
ADIR() - 使用任何通配符...
创建基于目录的数组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
答案 1 :(得分:1)
您还可以使用文件系统对象获取更多信息:
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