Creates a directory/folder.
DirCreate ( "path" )
path | Path of the directory to create. |
Success: | 1. |
Failure: | 0 if there was an error creating the directory. |
This function will also create all parent directories given in "path" if they do not already exist.
#include <AutoItConstants.au3>
#include <MsgBoxConstants.au3>
Example()
Func Example()
; Create a constant variable in Local scope of the directory.
Local Const $sFilePath = @TempDir & "\DirCreateFolder"
; If the directory exists the don't continue.
If FileExists($sFilePath) Then
MsgBox($MB_SYSTEMMODAL, "", "An error occurred. The directory already exists.")
Return False
EndIf
; Open the temporary directory.
ShellExecute(@TempDir)
; Create the directory.
DirCreate($sFilePath)
; Display a message of the directory creation.
MsgBox($MB_SYSTEMMODAL, "", "The directory has been created.")
; Remove the directory and all sub-directories.
DirRemove($sFilePath, $DIR_REMOVE)
; Display a message of the directory removal.
MsgBox($MB_SYSTEMMODAL, "", "The sub folder: Folder2 has been deleted.")
EndFunc ;==>Example