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