troubleshooting Question

VFP9 File Exists?

Avatar of formadmirer
formadmirerFlag for United States of America asked on
6 Comments2 Solutions3540 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)

Open in new window

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
	WAIT WINDOW "ftc not exist " + lcFileToCheck
	IF FILE(lcNoImage)
		WAIT WINDOW "no_image exists " + lcNoImage
		COPY FILE (lcNoImage) TO (lcFileToCheck)

Open in new window

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.
Olaf Doschke
Software Developer

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 2 Answers and 6 Comments.
Start Free Trial
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 2 Answers 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