Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Finding a blank directory.
Message
De
04/07/1997 06:39:12
 
 
À
03/07/1997 18:30:03
Renato De Giovanni
Via Fractal Information Systems
São Paulo, Brésil
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00038130
Message ID:
00038649
Vues:
43
>>>>I can't seem to find a way to tell if a directory exists. It seems like such a simple task, but the only thing I can think of is to use the FILE command to find a file inside the directory in question. What if there are no files in the directory? I thought I'd better ask the experts before I waste too much time on a seemingly simple task. Thanks for any help.
>>>>Marcus.
>>>
>>>Hi Markus,
>>>
>>>I've learned here to do that with the FILE command, you just need to search for a file called NUL into the directory in question.
>>>
>>>?FILE("c:\testdir\NUL")
>>>
>>And what about ADIR() ?
>>
>>As I know, File() works fine only on local drives. Or is it no longer true?
>
>Well, I never had any problem using the FILE() command.
>
>As for the ADIR() question, the thread title could bring some misunderstanding. Markus wants to check for the existence of a directory, and not if an existing directory has or not files.
>
>To check for the existence of a directory I believe it's better to use FILE() than ADIR(). FILE() needs only one parameter and it doesn't gives you an array as a gift. That means less code, less things to remember, less chances to run into errors, and more time...

Please see:
http://www.microsoft.com/kb/articles/q95/3/73.htm,
http://www.microsoft.com/kb/articles/q94/3/39.htm
These articles describe the problem with FILE() on networks.
You will get an answer why you never had any problem at using FILE() on network.
The articles say, that this problem is under VFP 3.0, too. But VFP 5.0 isnot mentioned. I am not sure, that it means, that this bug is fixed in 5.0. I couldnot test it, because I have only Workgroup (with NT) LAN. It is possible, that on Novell, FILE() still doesnot work in VFP5.0.

P.S.:
In the last article you will see, that it is possible to use ADIR() in an only line:

IF ADIR(test,'Z:\mydir\*','D') <> 0
WAIT WIND "Z:\mydir exists"
ENDIF

Good luck:
BB
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform