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:34:29
 
 
To
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:
00192428
Views:
19
>>>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.

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
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Reply
Map
View

Click here to load this message in the networking platform