Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Cannot create file error
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Cannot create file error
Miscellaneous
Thread ID:
00559457
Message ID:
00559457
Views:
62
I am trying to copy files that are .SCX forms and .EXE from a group of projects .PJX that I list in a projects DB. I get the error cannot create file when I do COPY FILE current.SCX TO target.SCX

Is there a way to do this without having a file already there? Where I create the destination directory and copy to it in one step? Thanks for the help.

Here's my code -
*****************************************
* Copy/Backup .SCX forms and .EXE files *
*****************************************

PUBLIC proj_drive proj_dir
USE projdbfs IN 0 SHARED
SELECT projdbfs
SCAN
	SELECT projdbfs
	pathname = projdbfs.proj_drive+":\"+ALLT(projdbfs.proj_dir)+"\"+ALLT(projdbfs.proj_name)+".PJX"
	IF FILE(pathname)
		USE (pathname) IN 0 SHARED ALIAS proj_file
	ELSE
		MESSAGEBOX("Project not found at expected location. Verify the project name, drive, and directory for accuracy.",64,"Data Dictionary")
		RETURN
	ENDIF
	SELECT proj_file
	SCAN
		IF proj_file.type = "K"
			FormName = SUBSTR(ALLT(proj_file.name),1,Len(ALLT(proj_file.name))-5)
			formpath = projdbfs.proj_drive+":\"+ALLT(projdbfs.proj_dir)+"\"+ALLT(FormName)+".SCX"
			IF FILE(formpath)
				destpath = "D:\BACKUP\"+ALLT(projdbfs.proj_dir)+"\"+ALLT(FormName)+".SCX"
				COPY FILE (formpath) TO (destpath)
			ENDIF
		ENDIF
		IF proj_file.type = "P"
			ProgName = SUBSTR(ALLT(proj_file.name),1,Len(ALLT(proj_file.name))-5)
			progpath = projdbfs.proj_drive+":\"+ALLT(projdbfs.proj_dir)+"\"+ALLT(ProgName)+".EXE"
			IF FILE(progpath)
				destpath = "D:\BACKUP\"+ALLT(projdbfs.proj_dir)+"\"+ALLT(ProgName)+".EXE"
				COPY FILE (progpath) TO (destpath)
			ENDIF
		ENDIF
	ENDSCAN
	SELECT proj_file
	USE
ENDSCAN
SELECT projdbfs
USE
Steve Kramer
Kramer & Kramer Design
"Home of Go Cartoons"
Web Site: www.stephenkramer.com
Would you believe Far Side Lite?
More than 270 original cartoons.
Next
Reply
Map
View

Click here to load this message in the networking platform