Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to know if directory already exists before MKDIR?
Message
De
06/11/1998 09:31:20
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00155183
Message ID:
00155194
Vues:
28
>want to create a temporary directory, if it does not already exist. if it does exist then i want to do nothing. what is a good method?

You can use ADIR to check if the directory exists, and verify that it is in fact a directory:
LOCAL aFiles[1,5]
IF ADIR(aFiles,'C:\TheDir\Path\ToCheck','D') = 0
   *  The directory does not exist, and there is no conflicting filename
   *  so you want to create it here
ELSE
   IF 'D' $ aFiles[1,5]
      *  The directory exists
   ELSE
      *  The directory doesn't exist, but there's a file with the same name,
      *  so you can't create a directory with this name
   ENDIF
ENDIF
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