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

Using COPY TO with a destination

Status
Not open for further replies.

breezett93

Technical User
Jun 24, 2015
128
0
16
US
Hello,

I am trying to create a program that will take an output file, convert it into a .dbf, and then send that file to a specific location to be grabbed for payroll.

I was reading about COPY TO, but I noticed none of the examples would include a destination to copy the file to.

Are either of these commands acceptable:

COPY TO a:\myDirectory\mySubDirectory or
COPY myTable TO a:\myDirectory\mySubDirectory


Thanks!
 
VFP has COPY TO (copy the current workarea to a file) and COPY FILE (copy a file), in that way your second COPY is invalid.
But both copy commands take a fully qualified file name including full path with drive letter or UNC servername and network share name.

Bye, Olaf.
 
Code:
SELECT myTable
COPY TO a:\myDirectory\mySubDirectory\myTable

or

Code:
SELECT myTable
COPY TO ("a:\myDirectory\mySubDirectory\"+ALIAS())
 
Also remember that if needed, the COPY TO command can convert the DBF file to a different type.
Example:
Code:
SELECT MyTable
cDestination = <some pathed file>
COPY TO (cDestination) CSV  && to convert to CSV destination file type

Good Luck,
JRB-Bldr
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top