break on cls
$tempdir = "temp1.dat"
$tempfile = "temp2.dat"
dim $tempdir_data[99999]
:wrong
? "This will Delete all files and Directories in"
? "%temp%!!! are you sure?(y/n)"
get $yn
select
case lcase($yn) = "y"
;run rest of code
case lcase($yn) = "n"
exit
case 1
goto wrong
endselect
shell "%comspec% /c dir %temp% /ad /b /s > $tempdir"
shell "%comspec% /c dir %temp% /a-d /b /s > $tempfile"
? "Deleting the files in %temp%" gosub kill_files
? "Removing all Directories in %temp%" gosub Kill_directories
del $tempdir
del $tempfile
exit
;----------------------------
:Kill_Files
;----------------------------
$q = open(1,$tempfile)
$tempfile_data = readline(1)
while @error = 0
del $tempfile_data
$tempfile_data = readline(1)
loop
$q = close(1)
return
;----------------------------
:Kill_directories
;----------------------------
$array_count = 0
$q = open (1,$tempdir)
$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
return