Deletes a directory/folder.
DirRemove ( "path" [, recurse] )
|path||Path of the directory to remove.|
|recurse|| [optional] Use this flag to specify if you want to delete sub-directories too.
0 = (default) do not remove files and sub-directories
1 = remove files and subdirectories (like the DOS DelTree command)
|Failure:||Returns 0 if there is an error removing the directory (or if directory does not exist).|
; Delete C:\Test1 and all subdirs and files
Local $sFldr1 = "C:\Test1\"
Local $sFldr2 = "C:\Test1\Folder1\"
Local $sFldr3 = "C:\Test1\Folder1\Folder2\"
If DirGetSize($sFldr1) = -1 Then
Local $explorer = RunWait("explorer /root, C:\Test1\Folder1")
Local $handle = WinGetHandle($explorer)
MsgBox(262144, "Message", "Explorer is opened with Folder2 displayed.")
MsgBox(262144, "Message", "The sub folder: Folder2 has been deleted.")
DirRemove($sFldr1, 1) ;clean up test folders
MsgBox(48, $sFldr1, "Directory already exists!")