Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Existence of a folder?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00006381
Message ID:
00038352
Vues:
41
>>How to check if a folder exists already
>
>Try this:
>
>DECLARE integer FindFirstFile IN Win32API AS FindFirst ;
>  STRING @lpfn, STRING @lpfbuf
>lpfbuf = space(512)  && just to be on the safe side
>lpfn = 'C:\WINDOWS'  && this is the directory name we're looking for
>h = FindFirst(@lpfn, @lpfbuf)
>IF (h = -1)
>  ? "We know it's not there"
>ELSE
>  ? "We now have to figure out if it's really a folder or just a file."
>  IF BITAND(Asc(SubStr(lpbuf, 1, 1)), BITNOT(16))
>    ? "This, according to my research means it's a folder"
>  ELSE
>    ? "If that bit wasn't set, then it's not a folder"
>  ENDIF
>ENDIF
>
I've tested that function. Isn't this the same as:

? ADIR(laDir,lcYourDirPathHere,'D')

If this return .T., this means it's a directory.

Or, is there a difference between a directory and a folder?
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform