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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Copy .dbf foxpro 6 to foxpro 2

Status
Not open for further replies.

noway320

MIS
Aug 12, 2010
19
US

I have one question that I want to copy some .dbf files from foxpro 6.0 to foxpro 2.0 always for use of some SAS programming.

Do you have any idea about any macros written so there will be no need to write code again and again.

Please help me out.

Thanks & regards
 
In fact, this is easy.

The command you want is:

Code:
COPY xx TO yy TYPE FOX2X

where xx is the 6.0 file and yy is the 2.x file.

If you put that command into a PRG file, you will be able run it whenever you want.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro tips, advice, training, consultancy
Custom software for your business
 
Well that's great! But i want to do that automated; like if there are 1000000 files in ver 6.0 and i want to copy that all into 2x version then i really don't want to do it manually, So i need a macro which i can run only once and all files can be copied in 2x version.
 
Some hard coding here... Copies all files from C:\$temp dir to C:\$temp\newdir in a 2x format. I assume you do not wan the CDX indexes since you are going to 2x but if you did you could add the CDX at the end of the copy statement. See COPY TO help for more info... You can google it or look it up in VFP help if you have it installed.

Code:
SET DEFAULT TO 'c:\$temp\'

DECLARE laFiles[1]
lnCount = ADIR('laFiles','*.dbf')

FOR lni = 1 TO lnCount
	WAIT WINDOW NOWAIT "Prcessing: " + ALLTRIM(STR(lni)) + " of " + ALLTRIM(STR(lnCount))
	lcFileName = laFiles[lni,1]
	lcNewName = "c:\$temp\newdir\" + lcFileName 

	IF USED((laFiles))
		SELECT (laFieles)
		GO TOP
	ELSE
		USE (laFiles)
	ENDIF
	COPY TO (lcNewName) TYPE FOX2X
	USE
ENDFOR

Jim
 
Awesome jim... its really great :) I really appreciate for you guys Jim and Mike.

thanks a lot!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top