Re: RUNNING XXCOPY.EXE

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Max,
Thanks. WIll have to study it for a while to understand it. Yes I have all
the files on the flash drive as the application runs OK from the flash
drive.
Tony

"Max" <max@xxxxxxx> wrote in message
news:eAyFvFrpHHA.208@xxxxxxxxxxxxxxxxxxxxxxx
"TonySper" <tsperduti@xxxxxxxxxxxxx> wrote in message
news:_uo6i.10799$JQ3.9847@xxxxxxxxxxxxxxxxxxxxxxxxx
Has anyone have code in VFP that will copy a folder and all the
subfolders to another location???
Tony


Hi,
below is what I am using to create a backup.
It runs from any harddrive. I dont see why it should not run from a flash
drive.
Your VFP-exe program file needs to be installed on the flash drive and the
VFP runtime libraries need to be on the machine.

** this code is in the Click function of a command button

** on a small form which asks "do you want to create a backup?"

THIS.Enabled= .F. && to avoid more than one click

this.MousePointer = 11 && show the sand clock


WAIT WINDOW "Please wait while creating a backup!" NOWAIT AT 20,40

** for running from inside of VFP point to the path

IF TYPE('gcstartpath') = 'U'

gcstartpath = "C:\Program Files\ShipMaintenance\"

ENDIF

** create a back up directory if not available

IF NOT DIRECTORY(gcstartpath+'backup',1)

MD gcstartpath+'backup'

ENDIF

** for running inside of VFP, if the variable not exists, create one

IF TYPE('gcdatapath') = 'U'

USE mem IN 0

SELECT mem

gcdatapath = ALLTRIM(mem.path) && mem is an existing table with the path

USE

ENDIF

CLOSE DATABASES ALL

LOCAL lcdir, lcfno

lcdir = SYS(5)+SYS(2003)+'\'

SET DEFAULT TO (gcdatapath)

SET SAFETY OFF && to avoid the question about overwriting existing files

lcfno = ADIR(arrfiles,'*.D*')

FOR nCount = 1 TO lcfno && Loop for all dbf, dct, dcx files

COPY FILE arrfiles(nCount,1) TO gcstartpath + "backup\"+arrfiles(nCount,1)

ENDFOR

lcfno = ADIR(arrfiles,'*.cdx')

FOR nCount = 1 TO lcfno && Loop for all cdx files

COPY FILE arrfiles(nCount,1) TO gcstartpath + "backup\"+arrfiles(nCount,1)

ENDFOR

lcfno = ADIR(arrfiles,'*.fpt')

FOR nCount = 1 TO lcfno && Loop for all fpt files

COPY FILE arrfiles(nCount,1) TO gcstartpath + "backup\"+arrfiles(nCount,1)

ENDFOR

this.MousePointer= 0

OPEN DATABASE datafile

SET DATABASE TO datafile

=MESSAGEBOX("Backup to Harddisk is completed!",64,"Info")

Thisform.Release




.


Quantcast