Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Why no Directory() like File()?
Message
De
10/12/1999 10:31:47
 
 
À
10/12/1999 10:07:43
Michael Dougherty
Progressive Business Publications
Malvern, Pennsylvanie, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00301679
Message ID:
00301707
Vues:
24
>There is a MkDir (MD) command, which works great if the directory doesn't exist. Rather than return false if it does, it generates an error. Is there a command that will let me first check if the directory exists before attempting to create it (and generating the error?)
>
>Or will I have to trap the error and resume? (which really offends my sense of code elegance)
>

You can check if a directory exists with DIRECTORY(), using ADIR(), or using the Scripting.FileSystemObject's FolderExists method - I posted an example of how all three could be used yesterday.

>On a similar note, how does one check a table for exclusive access before trying to open it exclusively? (i have a routine which tries exclusive and (if already used) the error trap returns to the next line, which checks if the table is open, and if not, opens shared. I hate it, but it works)


ISEXCLUSIVE() will tell you if you already have the file opened exclusively; you need to actually try to get exclusive access and trap the failure to determinate if it can be done. a FLOCK() is not equivalent to exclusive access.
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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform