Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #this script deletes files and folders from the Windows Temp folder
- option fieldsep,"."
- if @not(@ask(Delete temporary files?))
- stop
- end
- #create the list
- list create,1
- #load the folders (directories) from the temp folder
- list filelist,1,@windir(t)\*.*,d
- %x = 0
- %d = 0
- #repeat through them
- repeat
- #grab each one and store it in %i
- %i = @item(1,%x)
- if @file(%i,D)
- #try to delete it
- directory delete,%i
- #if successful increase the count
- if @ok()
- %d = @succ(%d)
- end
- end
- %x = @succ(%x)
- until @equal(%x,@count(1))
- #clear the list and now load the files
- #repeat through them same as above for the folders
- #and attempt to delete them
- list clear,1
- list filelist,1,@windir(t)\*.*
- %x = 0
- %f = 0
- repeat
- %i = @item(1,%x)
- if @file(%i)
- file delete,%i
- if @ok()
- %f = @succ(%f)
- end
- end
- %x = @succ(%x)
- until @equal(%x,@count(1))
- #alert the user as to how may folders and files have been deleted.
- info %f" temporary file(s) deleted"@cr()%d" temporary folder(s) deleted."
- stop
Advertisement
Add Comment
Please, Sign In to add comment