TheBlindHouse

Delete Temp Files

Apr 30th, 2015
227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. #this script deletes files and folders from the Windows Temp folder
  2.  
  3. option fieldsep,"."
  4. if @not(@ask(Delete temporary files?))
  5. stop
  6. end
  7. #create the list
  8. list create,1
  9. #load the folders (directories) from the temp folder
  10. list filelist,1,@windir(t)\*.*,d
  11. %x = 0
  12. %d = 0
  13. #repeat through them
  14. repeat
  15. #grab each one and store it in %i
  16. %i = @item(1,%x)
  17. if @file(%i,D)
  18. #try to delete it
  19. directory delete,%i
  20. #if successful increase the count
  21. if @ok()
  22. %d = @succ(%d)
  23. end
  24. end
  25. %x = @succ(%x)
  26. until @equal(%x,@count(1))
  27. #clear the list and now load the files
  28. #repeat through them same as above for the folders
  29. #and attempt to delete them
  30. list clear,1
  31. list filelist,1,@windir(t)\*.*
  32. %x = 0
  33. %f = 0
  34. repeat
  35. %i = @item(1,%x)
  36. if @file(%i)
  37. file delete,%i
  38. if @ok()
  39. %f = @succ(%f)
  40. end
  41. end
  42. %x = @succ(%x)
  43. until @equal(%x,@count(1))
  44.  
  45. #alert the user as to how may folders and files have been deleted.
  46. info %f" temporary file(s) deleted"@cr()%d" temporary folder(s) deleted."
  47. stop
Advertisement
Add Comment
Please, Sign In to add comment