Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. sponsors. rss.
 From: vinod kabdal
  Where is vinod kabdal?
 Delhi
 India
 vinod kabdal
 To: FoxGuy Degante
  Where is FoxGuy Degante?
 hawthorne
 California - United States
 FoxGuy Degante
 Tags
Subject: RE: Appending data from on dbf to another..
Thread ID: 199013 Message ID: 199073 # Views: 28 # Ratings: 0
Version: Visual FoxPro 9 SP2 Category: General VFP Topics
Date: Friday, October 17, 2008 8:33:41 AM         
   


> Hi, i was wondering, I have like 20 dbfs with a specific structure in a directory called data (a). i would like to append the data of every dbf in that directory to another directory (data B)with dbfs of different structure. The only thing is that in data (b) directory there are more columns and rows in the dbfs, and i have data on them. i would like to delete all the data from the dbfs of the data (b) directory and append the data from all the dbfs of the directory data (a). I want to keep the structure of data(b) dbfs (remember it has more columns) now the 2 directories have the same dbfs names. for example in the directory data(a) i have a dbf call inv.dbf and in the directory of data(b) i have the same dbf called inv.dbf. This is the same for all the 19 dbfs. Can this be done with code? I know that i can do it like this; open the inv.dbf with foxpro 9 and delete all the records and then append all the records from the inv.dbf from the directory data(a), i can do this for all the dbfs, but i was wodering if there was a faster way of doing this.
>
>
> Thanks


Hi FoxGuy Degante,
Use this command line data insert onefolder dbf to otherfolder dbf.
SET DEFAULT TO 'c:\tempfile\NewDataFolder'
SET SAFETY OFF
lnFiles = ADIR( laDBFs, '*.dbf' )
FOR lnCnt = 1 TO lnFiles
*** Get the filename
lcFileName = ladbfs[lnCnt,1]
IF LEFT( lcFileName, 1 ) = "."
*** Directory back-reference
LOOP
ENDIF
*** Open the table
USE (lcFileName) IN 0
SELECT (lcFileName)
ZAP
APPEND FROM "c:\tempfile\OldDataFolder\"+lcFileName
use
ENDF

Thanks

Vinod Kabdal



COMPLETE THREAD
Appending data from on dbf to another.. Posted by FoxGuy Degante @ 10/16/2008 8:06:08 PM
RE: Appending data from on dbf to another.. Posted by Brad Schulz @ 10/16/2008 8:24:37 PM
RE: Appending data from on dbf to another.. Posted by vinod kabdal @ 10/17/2008 8:33:41 AM