Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Checking for Folder existence using FILE()
Message
De
18/09/2001 08:56:15
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
FoxPro 2.x
Divers
Thread ID:
00557314
Message ID:
00557734
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).

Oh in Novell :) In Novell you can even show a drive as a dir too. I don't have Novell any more :) so I can't test. If I were going to use with Novell I would implement a Novell bin for e3 calls.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform