Get list Of Files in a Directory in Foxpro

China☆狼群 提交于 2019-12-11 05:12:28

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!