Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Anyone know of a way to check for valid path?
Message
From
28/02/1999 04:14:53
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00192165
Message ID:
00192423
Views:
18
>>does the following work as well?
>>
>>
>>mytest = lcPath + "\nul.txt"      && nul.txt should exist in every directory!
>>if file(mytest) then && dir exists
>>    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.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform