Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Checking for Folder existence using FILE()
Message
 
 
À
18/09/2001 08:33:11
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
Information générale
Forum:
Visual FoxPro
Catégorie:
FoxPro 2.x
Divers
Thread ID:
00557314
Message ID:
00557722
Vues:
11
>>< SNIP >
>>
>>>Mark,
>>>As Sergey said you'd change your checks to something like IsDir(lcPath).
>>>I meant asm was exception, if you don't need special folders that adir() can't access than go with adir(). ie (w/o error checking):
>>>
>>>
function IsDir
>>>lparameters tcPath
>>>private lnFiles
>>>lnFiles = adir(arrDummy,tcPath+'\*.*','D')
>>>return lnFiles > 0 and arrDummy[1,1]='.' and 'D'$arrDummy[1,5]
>>>Cetin
>>
>>It would return incorrect result if directory is empty. Here's working version
PARAMETER cDirectory
>>PRIVATE aDir
>>cDirectory = ALLTRIM(cDirectory)
>>IF RIGHT(cDirectory,1) = "\"
>>    cDirectory = LEFT(cDirectory, LEN(cDirectory)
>>ENDIF
>>RETURN ADIR(aDir, cDirectory, "D") > 0
>>
>
>Sergey,
>Nope. Unless it's a root directory it can't be empty.
>
>md c:\emptydir
>
>? adir(arrDir,'c:\emptydir\*.*','D') && Would return 2 at least
>? arrDir[1,1], 'Attribs :'+arrDir[1,5]
>
>
Cetin

Yep, with network drive it can be. Your function returned .F. for empty directory on the network drive (Novell).
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform