Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to check if a folder already exists?
Message
From
02/08/2000 21:56:45
 
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00400144
Message ID:
00400191
Views:
14
>>Use DIRECTORY(). It works just like FILE(). It was introduced in (I think) VFP 5.
>>
>>If you are using a version of FP/VFP which does not support DIRECTORY(), use FILE() and search for the NUL file. For instance,
>>
FILE("C:\MYFOLDER\NUL")
>>should return .T. if C:\MyFolder exists and .F. otherwise.
>>zahid
>
>Zahid,
>
>This does not work in all OS's (like NT or W2K). You can use ADIR() to check for the existance of a folder.
>
>IF ADIR(aTemp,"C:\MyFolder","D")=1
>
>then folder exists.

Either a file or a folder exists; you need to check the file attributes of the file in the rsultant array.

>>
>>>I know you can use the FILE() command to check to see if a file exists, but how can you check to see if a folder exists and create it if it does not? Nothing I have tried works.
>>>
>>>Thanks!
>>>Colombo.
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform