$Path = '\\thatPC\c$\Documents and Settings\user3\Start Menu'
; Call DelDir, let the return value fall to the screen,
; followed by the error value / message
DelDir($Path)
' / ' @ERROR ' / ' @SERROR ?
Function DelDir($strPath)
Dim $strFilename
$strFilename = Dir($strPath + "\*.*")
While $strFilename <> "" And @Error = 0
If $strFilename <> "." And $strFilename <> ".."
If (GetFileAttr($strPath + "\" + $strFilename) & 16)
DelDir($strPath + "\" + $strFilename)
If @ERROR $DelDir = 1 Exit @ERROR EndIf
SetFileAttr($strPath + "\" + $strFilename, 128)
Rd $strPath + "\" + $strFilename
If @ERROR $DelDir = 2 Exit @ERROR EndIf
Else
SetFileAttr($strPath + "\" + $strFilename, 128)
Del $strPath + "\" + $strFilename
If @ERROR Exit @ERROR EndIf
EndIf
EndIf
$strFilename = Dir()
Loop
; At this point, the directory should be empty. We just need to delete it now.
Rd $strPath
If @ERROR $DelDir = 3 Exit @ERROR EndIf
EndFunction