>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