Link to home
Start Free TrialLog in
Avatar of Eduardo Fuerte
Eduardo FuerteFlag for Brazil

asked on

Could you point how to correctly copy a file to a subfolder by using COPY FILE ?

Hi Experts

Could you point how to correctly copy a file to a subfolder by using COPY FILE ?

Accordingly with this code:
	*-- Runs OK
		Copy File &LCZIPFILE To &LCDRIVE

		*-- Doesn't runs

		m.driver_final = LCDRIVE + "Espiriplug\"
		Copy File &LCZIPFILE To &driver_final
*-- OR
		Copy FILE(LCZIPFILE) to (driver_final)

Open in new window


The error produced

User generated image
Any workaround to this situation?

Thanks in advance
ASKER CERTIFIED SOLUTION
Avatar of Pavel Celba
Pavel Celba
Flag of Czechia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Of course, the way how to copy the file to a subfolder without its target specification also exists - you must not use backslash at the end of the path.  This way has one drawback: If the subfolder does not exist then VFP creates the file named like the subfolder, so
lcDrive = "E:\"
driver_final = m.lcDrive + "Espiriplug"
COPY FILE (m.lcZipFile) TO (m.driver_final)  && copies the file into E:\Espiriplug subfolder if it exists
driver_final = m.lcDrive + "EspiriplugXYZ"
COPY FILE (m.lcZipFile) TO (m.driver_final)  && copies the file into E:\EspiriplugXYZ file

Open in new window

Avatar of Eduardo Fuerte

ASKER

Perfect

Thank you!