troubleshooting Question

VFP9 File Exists?

Avatar of formadmirer
formadmirerFlag for United States of America asked on
FoxPro
6 Comments1 Solution3540 ViewsLast Modified:
Is there something that would make VFP report that a file exists when it does not?

I was attempting to use:

lcNoImage = (pcGraphicsDir + "no_image.jpg")
lcFileToCheck = (pcProductImages + "no_image.jpg")
IF !FILE(lcFileToCheck)
	IF FILE(lcNoImage)
		COPY FILE (lcNoImage) TO (lcFileToCheck)
	ENDIF
ENDIF
However, even though the file to check does not exist, and the no_image file does, the file was not copied.

I replaced ! with NOT and got the same results.

So I added wait statements and reversed the logic:

lcNoImage = (pcGraphicsDir + "no_image.jpg")
lcFileToCheck = ((pcProductImages) + "no_image.jpg")
IF FILE(lcFileToCheck)
	WAIT WINDOW "ftc exists " + lcFileToCheck && do nothing
ELSE
	WAIT WINDOW "ftc not exist " + lcFileToCheck
	IF FILE(lcNoImage)
		WAIT WINDOW "no_image exists " + lcNoImage
		COPY FILE (lcNoImage) TO (lcFileToCheck)
	ENDIF
ENDIF
I get the wait window that says "ftc exists". Of course the file is not copied either.

The file to check absolutely does not exist at that path - the echoed lcFileToCheck path does show the correct path where VFP is saying the file exists, but it does not.

Once again, I'm stumped.
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 6 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros