Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to determine if a folder exists?
Message
De
14/02/2004 12:08:17
 
 
À
14/02/2004 11:40:29
Mike Sue-Ping
Cambridge, Ontario, Canada
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00877389
Message ID:
00877397
Vues:
13
Mike,

I'll explain. If you have a DIRECTORY called xxx, DIRECTORY('xxx') will return .T. which you want. However, If you have a FILE called xxx, DIRECTORY('xxx') will ALSO return .T. which you do NOT want.

ADIR(temp,'xxx','D')>0 will return .T. for a directory and .F. for a file. As far as I understood from your question, that was what you wanted?

>Tore,
>
>I'm not sure what it is you are getting at. Can you provide me with an example?
>
>If I use DIRECTORY("C:\MYFOLDER") in the debugger, VFP8 returns .T. because I do have this folder. Next, if I try to create a file named MYFOLDER on the root of drive C: without an extension, Windows complains and wont create it (no surprise here).
>
>Mike
>
>>Yes, less typing, but you can not tell whether you have a file or a directory with the given name. With my code you know that you have a directory and not a file!
>>
>>>Thanks for the snippet Tore. I'll use Michel's suggestion and go with DIRECTORY(). Its less typing :)
>>>
>>>Mike
>>>
>>>
>>>>
>>>>IF ADIR(temp,'mydir',"D")>0
>>>> && Directory mydir exists
>>>>ENDIF
>>>>
>>>>
>>>>>I'm using VFP8. How can I determine if a folder already exists? I can't seem to find a built in function.
>>>>>
>>>>>TIA
>>>>>
>>>>>Mike.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform