Paul B Walker


When a COPY File Command is executed and a space is in either a folder name or a file name, the instruction is unable to handle it. I have tried a technique to put in " quote marks in the manner '"<path><filename>"' but then it gives me a syntax error. Is this a bug or am I entering the full path and filename wrongly
If this is a known bug, is there a patch for it
If not, how do later versions of VFP do with this "bug"


Re: Copy File Error in Visual FoxPro 7?

AndyKr


This is not a VFP bug, it is general to Microsoft tools (including Word and Excel) and is one of the oddities that Microsoft allow you put spaces in paths, but don't hanlde them directly in their products. Ah well.

The solution is to enclose the path in quotes, but not as a quoted string as you are showing:

COPY FILE "D:\VFP90\APPLICATION DEVELOPMENT\trycatchtest.prg" TO "C:\Program Files\ComPlus Applications\aktest.prg"

should work just fine in any version of VFP.






Re: Copy File Error in Visual FoxPro 7?

Paul B Walker

Thanks Andy. I believe that I tried the solution you mentioned, but it failed to work. It may have been further impaired by the fact I was using macro variables for the path filename and I don 't believe the quotes got through to the final command
The party in question has now removed the spaces in the path and filename, so it's a moot point.





Re: Copy File Error in Visual FoxPro 7?

AndyKr

>>Thanks Andy. I believe that I tried the solution you mentioned, but it failed to work. It may have been further impaired by the fact I was using macro variables for the path filename and I don 't believe the quotes got through to the final command

I didn't just make it up you know. I actually tested it and I can assure you it does work. Now the possibilitiy that you were stripping the quotes off would certainly account for the fact that it didn't work for you, you must delimit pathnames that contain spaces because, as it states in the Windows Help file "Spaces are significant in File and Path names" .

But your solution is MUCH better - to paraphrase what Andy Ross McNeil once said about using long field names..."You can use spaces in directory names, but arsenic is quicker and less painful"






Re: Copy File Error in Visual FoxPro 7?

SharathMum

if your using the macro are you using &cPath make It (cPath) it will work

e.g.
cPath = "C:\Program Files\My App\Out Put\Some file.xls"

COPY TO (cPath) TYPE XLS

AndyKr  method as to work,
the thing is that u have not mentioned that your using macro
 






Re: Copy File Error in Visual FoxPro 7?

Paul B Walker

Is &cPath a special word or function Please explain. I was using my own words for the macros.




Re: Copy File Error in Visual FoxPro 7?

SharathMum

Paul B Walker wrote:
Is &cPath a special word or function Please explain. I was using my own words for the macros.


u said that your are using variables for the path filename

cPath is the variable name which contains the Path

& is
Macro substitution

i have posted the example code also


cPath = "C:\Program Files\My App\Out Put\Some file.xls"

COPY TO (cPath) TYPE XLS





Re: Copy File Error in Visual FoxPro 7?

Tamar E. Granor

& is the macro operator in VFP. It expands the string and inserts the result into the command. So, for example:

cFile = "MyTable"
USE &cFile IN 0

is equivalent to writing:

USE MyTable IN 0

However, even if you need the indirection in that command, using a macro is a bad idea, because you can use what's called a "name expression":

USE (cFile) IN 0

What do you mean by "using my own words for the macros"

Tamar