Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Weird problem: Copy File adds folder to path

Status
Not open for further replies.

TamarGranor

Programmer
Jan 26, 2005
2,483
US
Let me start by saying we've found a workaround, so I'm posting this because I want to know the answer, not because I need a solution.

A vertical market application I'm working on has a routine that copies a couple of files from one folder to another, changing the name in the process. It's been working for quite some time, but last week, some (but not all) users started having problems. The error log shows that there's an extra folder in the path for the source file. That is, there's a variable with a value like:

[pre]C:\MyFolder\MyFile.FRX[/pre]

When COPY FILE is handed this variable, the error message says it can't find:

[pre]C:\MyFolder\Reports\MyFile.FRX[/pre]


In trying to track this down this morning, we actually replaced the variable with a hard-coded path to the file, so the command was like:

[pre]COPY FILE C:\MyFolder\MyFile.FRX TO C:\MyOtherFolder\MyOtherFile.FRX[/pre]

We still got an error that showed Reports in the path.

What can I add? These aren't actually on C; the folders are on a mapped drive. The source file exists and we have no problem copying it via Explorer.

As I said, we've found a work-around. We're using the CopyFile API function and it works as expected.

Anybody have a clue what would cause this?

Tamar
 
Tamar,

is there a myfile.frx included in the project?

I seem to remember FILE() gets confused when the filename is in the project but you're actually testing for a different folder.

n
 
I second Nig4els question, though COPY FILE isn't FILE() or FILETOSTR(), which both look in the EXE.

I guess you have ET PATH to some relative folders like \Report, and this influences it. I know the path given in an error message can differ from the path given in code, even absolute hard-coded paths, when VFP searches in SET('PATH') paths and uses relative paths relative to the current default path, besides also searching in system paths like Windows\System32 or SysWOW64.

The question is, why VFP begins to search along SET('PATH') paths, there have to be short term network errors or outages causing this.


Chriss
 
Thanks. I'm now fairly convinced that the issue is VFP's preference for files in the project (yes, there's a copy in the Reports\ folder in the project).

Reports\ is NOT in the path, but I think it's the search in the EXE that's causing the problem.

Tamar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top