I use also Bryce's script and for me it works fine and fast. In NT/Win2k it's more difficult to do the thing that "deltree /y" does, because this util does not exist in NT/Win2k.Here's the script I use:
code:
$userTempDirectories = "userTempDirectories.txt"
$userTempFiles = "userTempFiles.txt"
Dim $tempdir_data[99999]Shell "%comspec% /c attrib -h -r %temp%\*.* /s /d"
Shell "%comspec% /c dir %temp% /ad /b /s > $userTempDirectories"
Shell "%comspec% /c dir %temp% /a-d /b /s > $userTempFiles"
Gosub deleteUserTempFiles
Gosub deleteUserTempDirectories
:deleteUserTempFiles
$q = Open(1,$userTempFiles)
$tempfile_data = ReadLine(1)
While @ERROR = 0
Del $tempfile_data
$tempfile_data = ReadLine(1)
Loop
$q = Close(1)
Del $userTempFiles
Return
:deleteUserTempDirectories
$array_count = 0
$q = Open (1,$userTempDirectories)
$tempdir_data[$array_count] = ReadLine(1)
While $tempdir_data[$array_count] <> ""
$array_count = $array_count + 1
$tempdir_data[$array_count] = ReadLine(1)
Loop
$q = Close(1)
Rd $tempdir_data[$array_count]
While $array_count >= 0
Rd $tempdir_data[$array_count]
$array_count = $array_count - 1
Loop
Del $userTempDirectories
If Exist ("%temp%") = 0
Md "%temp%"
EndIf
Return
Exit
I"n some cases the temp-dis were also removed, so I added a check to see if the dir exist, and if not, make that dir again.
Martijn