Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
A final question regarding my problem
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00414628
Message ID:
00414630
Views:
24
>Earlier today I was very grateful when you all helped me with my problem. The code worked great with one exception. It only appended the first file. What I am trying to accomplish is appending for instance 25 different text files delimited with the same structure to one table. It takes only the first text file, appends it perfectly, but then stops. Do I need to write a loop. Any help would be appreciated the code is below.
>
>lparameters tcPath
>local lnFiles, ix
>m.lnFiles = adir(aTextFiles, m.tcPath+'*.txt')
>for m.ix = 1 to m.lnFiles
> wait window nowait 'Appending : '+m.tcPath+aTextFiles[m.ix,1]
> append from (m.tcPath+aTextFiles[m.ix,1]) delimited with character :
>endfor
>wait clear
>
>At this point I chose the table and ran the program. However as I said only the first file appended.


Just tested it and it works.
My test was:
create a file file1.txt with data
1:2:3
4:5:6
create a file file2.txt with data
a:b:c
1a:2b:3c
create a program test.prg with the code above
create a table with 3 character fields
run
do test with curdir()
Result is:
1:2:3
4:5:6
a:b:c
1a:2b:3c

So everything works.
Are the text files all in the same directory?
This method doesn't look in subdirs.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform