Information générale
Catégorie:
Codage, syntaxe et commandes
>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 and MD or use the Windows API (see below). You could also just do the MD and let the error event or ON ERROR catch it. I prefer the Windows API, because I get an error code if it fails.
* Use ADIR and MD
LOCAL laDir
IF ADIR(laDir, "C:\Temp\MyDir", "D") = 0
MD "C:\Temp\MyDir"
ELSE
* Directory does not exist
ENDIF
* Use Windows API
DECLARE Integer CreateDirectory IN Win32API ;
String cPathName, String @cSecurityAttributes
IF CreateDirectory("c:\Temp\2", .NULL.) = 0
* Could not create directory (probably because it exists)
ENDIF
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement