Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Appending Multiple .dat files 1

Status
Not open for further replies.

EBOUGHEY

Programmer
Aug 20, 2002
143
US
Is there an easy little program to append multiple files to one database?

The one below is not working very well since there are 280 dat files to append....

FOR X = 1 TO 280
XVAR = GETFILE('dat')
APPE FROM ALLTRIM(LOWER(XVAR)) deli


Thanks for any assistance!
 
Assuming all files are in the same directory...

pnFileCount = ADIR(paFiles,'*.dat')
FOR lni = 1 To pnFileCount
APPE FROM paFiles[lni] deli
ENDFOR


Jim Osieczonek
Delta Business Group, LLC
 
I get the error "not a character expression". hmmmmm....
 
*!* Try changing the code above to this:
pnFileCount = ADIR(paFiles,'*.dat')
FOR lni = 1 To pnFileCount
APPEND FROM (paFiles[lni]) DELIMITED
ENDFOR

*!* Or if you'd like you can do it like this:
lcPathAndMask = "C:\*.dat"
lcFile = Sys(2000, lcPathAndMask)
Do While !Empty(lcFile)
APPEND FROM (lcFile) DELIMITED
lcFile = Sys(2000, lcPathAndMask, 1)
Enddo


boyd.gif

craig1442@mchsi.com
"Whom computers would destroy, they must first drive mad." - Anon​
 
Craig - HI!!! Remember me?

It's working now with the second code you put up...

Thanks for saving me so much time!
 
Elena,

Yes, I do remember you. [smile]

I'm glad the second solution worked for you. Was the first solution still throwing an error for you? Just curious.

boyd.gif

craig1442@mchsi.com
"Whom computers would destroy, they must first drive mad." - Anon​
 
the 1st one was still giving me the error. not sure why. I tried several different things with it to no avail.
 
Good catch jimoo...I missed it.

boyd.gif

craig1442@mchsi.com
"Whom computers would destroy, they must first drive mad." - Anon​
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top