>>>does the following work as well?
>>>
>>>
>>>mytest = lcPath + "\nul.txt"
>>>if file(mytest) then
>>> copy file (myhappyfile) to (lcPath)
>>>else
>>> md lcPath
>>> copy file (myhappyfile) to (lcPath)
>>>endif
>>>
>>>
>>
>>A second problem here - in addition to the nul.txt being an invalid test, you must supply the full name of the tart file, not just a path prefix; IOW, the copy command would need to read:
>>
>>COPY FILE (myhappyfile) TO (lcPath + JUSTFNAME(myhappyfile))
>>
>>JUSTFNAME() is a native function for VFP 6; it requires FOXTOOLS.FLL to be loaded in earlier versions.
>
>The shortest (for lazy programmers):
>
>
>if not directory(lcPath)
> md (lcPath)
>endif
>COPY FILE (myhappyfile) TO (ForcePath(myhappyfile, lcPath))
>
>
>ForcePath() is another FoxTools citizen who made it into regular citizenship in VFP6.
Aside from the problems I've had in the past with DIRECTORY() not behaving, and the MKDIR could still fail to work for several reasons (an intervening file might keep you from creating the directory, or you might not have sufficient rights to create the directory), I completely forgot about FORCEPATH() - just shows I'm not a candidate for the Dark Beer Club...
Thanks,
Ed