Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Help with a Foxpro programming question
Message
From
09/09/2000 12:37:04
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00414601
Message ID:
00414603
Views:
23
>To anyone willing to help:
>
>This is my first time utilizing the forum. I would like to post this question about a small programming question I have and the best way to write the code. What I am attempting to do is append multiple text files with different names (but all have the exact same structure) to a table. The line of code I am currently using from the command window is APPEND FROM C:\DATA\CHARLOTTEPERSONS.TXT DELIMITED WITH CHARACTER :
>
>My problem is I have hundreds of files to append, and all that changes is the city name in front of persons.txt. It is very tedious to go city by city. Couldn't I automate this using a variable statement somehow ? Any help would be greatly appreciated.
>
>Thank you.
>
>
>Phil Von Haak
>International Internet
>vonhaak@aol.com


Wellcome Phil :)
You could automate it in many ways. I'll provide one assuming all txt files are kept in a separate directory :
lcDir = getdir()
if empty(lcDir)
 messagebox('No dir selected')
 return
endif
lnFiles = adir(aTextFiles,lcDir+'*.txt')
for ix = 1 to lnFiles
  APPEND FROM ;
    (lcDir+aTextFiles[ix,1]) ;
    DELIMITED WITH CHARACTER :
endfor
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform