Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Delete / Copy files
Message
 
 
To
28/03/2002 15:59:06
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00638661
Message ID:
00638730
Views:
20
You've to enclose variable names in the parenthesis to tell VFP to use there values. It's caled 'Name expression'. Otherwise VFP uses variable name as a file name because it expects file name in that place.
SCAN
	cTableName = SUBSTR(TEMPDBFFIX.TABLE, AT('\', TEMPDBFFIX.TABLE,1)+1)
	cFileName = lcTemplatePath + 'TEMPLATE\DATA\' + TRIM(cTableName) + '.*'
	*-- Delete all tables in Template Data directory
	DELETE File(cFileName)
	*-- Copy files from production fileshare to backup template on server
	cTableName = OAPP.CDEFAULT + TRIM(TEMPDBFFIX.TABLE) + '.*'
	COPY File(cTableName) TO (cFileName)
ENDSCAN
>I am adding new functionality to our software (which is currently running in VFP 5.0) to automatically copy our data files to select user's pcs in case our users ever lose their network connection. I thought what I was doing was going to be very easy but is turning out to be very difficult. First I need to delete the existing files, then download the current files. I am trying to do the following but it is not working...it appears as though I cannot use a variable name in DELETE / COPY commands.
>
>SCAN
>cTableName = SUBSTR(TEMPDBFFIX.TABLE, AT('\', TEMPDBFFIX.TABLE,1)+1)
>cFileName = lcTemplatePath + 'TEMPLATE\DATA\' + TRIM(cTableName) + '.*'
>*-- Delete all tables in Template Data directory
>DELETE FILE cFileName
>*-- Copy files from production fileshare to backup template on server
>cTableName = OAPP.CDEFAULT + TRIM(TEMPDBFFIX.TABLE) + '.*'
>COPY FILE cTableName TO cFileName
>ENDSCAN
>
>I am scanning a table that has a list of all tables in the database to make it easier, at least I thought. Does anyone have an suggestions as to how I can make this work, or if there is an easier way to do it?
>
>TIA!
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform