Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Existence of a folder?
Message
From
01/07/1997 23:42:25
 
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00006381
Message ID:
00038352
Views:
45
>>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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform