Tyhjentää Temp- tiedoston kaikesta. Voit myös poistaa nuo msgbox:it ja laittaa ohjelman käyntiin esim. windowsin käynnistyessä jolloin ei tempistä ole enää haittaa.
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load On Error Resume Next Dim del As Integer = 0 Dim total As Integer = 0 Dim left As Integer = 0 For Each filu In My.Computer.FileSystem.GetFiles("C:\Windows\Temp\") My.Computer.FileSystem.DeleteFile(filu) If (My.Computer.FileSystem.FileExists(filu)) Then left = left + 1 Else del = del + 1 End If total = total + 1 Next MsgBox("Stats:" & vbCrLf & "Total files: " & total & vbCrLf & "Deleted files: " & del & vbCrLf & "Failed to delete: " & left & " files") Dim del2 As Integer = 0 Dim total2 As Integer = 0 Dim left2 As Integer = 0 For Each dirri In My.Computer.FileSystem.GetDirectories("C:\Windows\Temp") My.Computer.FileSystem.DeleteDirectory(dirri, FileIO.DeleteDirectoryOption.DeleteAllContents) If (My.Computer.FileSystem.DirectoryExists(dirri)) Then left2 = left2 + 1 Else del2 = del2 + 1 End If total2 = total2 + 1 Next MsgBox("Stats:" & vbCrLf & "Total dirs: " & total2 & vbCrLf & "Deleted dirs: " & del2 & vbCrLf & "Failed to delete: " & left2 & " dirs") End End Sub
Aihe on jo aika vanha, joten et voi enää vastata siihen.