Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Help with reading from multiple text files
Message
From
01/03/2005 22:32:35
 
 
To
01/03/2005 22:11:54
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 6 SP5
Database:
Visual FoxPro
Miscellaneous
Thread ID:
00991855
Message ID:
00991856
Views:
23
Look into the ADIR() function. It will load the files into an array for you. You can pass it a skeleton too (i.e. ADIR(laFiles,"*.dat")). It also accepts a parameter that will help you to go through the subdirectories as well.

Code will be something to the effect of:
lnFileCount=ADIR(laFiles,'*.dat')
For lnFile = 1 to lnFileCount
  lcFileName=laFiles[lnFile,1]
  Append From &lcFileName SDF
EndFor
Of course you'll have to add in code to have it scan through the subfolders as well.

Aloha,

James

>how do i get a list of all filenames with a .dat extension stored in a folder? also, i want to read data from these files and append it to a table.
>
>do i save first all files with .dat in an array, then read and append them one by one in a table?
>
>there are multiple folders too, with folder names such as reg01 to reg14.. i want to be able to read in each folder all files with .dat extensions.
>
>how do i do that?
Previous
Reply
Map
View

Click here to load this message in the networking platform