Func _DirRemoveContents($folder) Local $search, $file If StringRight($folder, 1) <> "\" Then $folder = $folder & "\" If NOT FileExists($folder) Then Return 0 FileSetAttrib($folder & "*","-RSH") FileDelete($folder & "*.*") $search = FileFindFirstFile($folder & "*") If $search = -1 Then Return 0 While 1 $file = FileFindNextFile($search) If @error Then ExitLoop If StringRight($file, 1) = "." Then ContinueLoop DirRemove($folder & $file, 1) WEnd Return FileClose($search) EndFunc
That is how I do it. I know you could just just do somthing like DirRemove($folder) then DirCreate($folder), but there are times when this is not a good idea.
Well maybe someone new to autoit will find this useful.
With the help of SlimShady.
Edited by hankjrfan, 05 November 2005 - 01:09 AM.