Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get list Of Files in a Directory in Foxpro

How can i get list of files in a directory programatically in foxpro?

like image 342
Hossein Moradinia Avatar asked Nov 16 '25 23:11

Hossein Moradinia


2 Answers

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
like image 168
DRapp Avatar answered Nov 19 '25 14:11

DRapp


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
like image 45
geoff franklin Avatar answered Nov 19 '25 13:11

geoff franklin