Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Directory() returns incorrectly?
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00111589
Message ID:
00111750
Views:
14
>I have a subdirectories on my machine f:\develop\myWork\temp and ..\data
>
>? directory('f:\develop\myWork\data') returns .T.
>? directory('f:\develop\myWork\temp') returns .F. (sometimes .T.)?
>? directory('data') returns .T.
>? directory('temp') returns .F. (sometimes .T.)?
>
>What gives? I need to know if temp exists, if it doesn't I want to create it on the fly.
>
>Does anyone have a better solution to directory()? I don't trust it.
>
>Robert

I've had bad results with DIRECTORY, and have found that ADIR() works better for me in many environments, especially with networks (NetWare has always been painful.) Rather than:

IF DIRECTORY('Data')

try:

LOCAL aTestDir[1,5]
IF ADIR(aTestDir,'Data','D')#0

Additional attribute parameters can be added for hidden and system directory support. And you can explicitly examine aTestDir[] for details on each match, since the second argument can be a wildcard expression. ADIR() works reliably with UNCs and long filenames as well.

hth,

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
Next
Reply
Map
View

Click here to load this message in the networking platform