Dealing with unwanted chrome cache data & visual studio log file

I am not sure this is the best way to deal with these unwanted files.
YES I wrote a small VB.Net application to delete chrome cache data files that have this format “f_00006a” & another file that shows up in a Temp folder every time I start my computer “dd_updateconfiuration_202.log” and
if my computer is idle for 10 min or more Visual Studio tries to update
and adds a bunch of these dd files to the temp folder REAL Annoying
YES I have VS 2019 and have it set to not request updates
Here is the code I wrote to deal with this feel free to offer suggestions
for improvements to this code. It works fine but seems like overkill to
deal with the situation.

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>Public Class frmStart
Public Sub frmStart_KeyPress(sender As Object, e As KeyPressEventArgs) Handles Me.KeyPress
If Asc(e.KeyChar) = 27 Then
Application.Exit()
End If
End Sub
Private Sub btnVCache_Click(sender As Object, e As EventArgs) Handles btnVCache.Click
lstFiles.Items.Clear()
Dim folderPath As String = "C:UsersDwightAppDataLocalGoogleChromeUser DataDefaultCacheCache_Data"
Process.Start(folderPath)
'Me.WindowState = FormWindowState.Minimized
End Sub
Private Sub btnVTemp_Click(sender As Object, e As EventArgs) Handles btnVTemp.Click
lstFiles.Items.Clear()
Dim folderPath As String = "C:UsersDwightAppDataLocalTemp"
Process.Start(folderPath)
End Sub
Private Sub btnDelCache_Click(sender As Object, e As EventArgs) Handles btnDelCache.Click
Dim folderPath As String = "C:UsersDwightAppDataLocalGoogleChromeUser DataDefaultCacheCache_Data"
Dim filePattern As String = "f*"
Dim result As MsgBoxResult = Nothing
Dim files As IEnumerable(Of String) = Directory.EnumerateFiles(folderPath, filePattern)
lstFiles.Items.Clear() 'WORKS where to use it and HOW TO USE
Try
If files.Any() Then
MsgBox("Files Found", vbOKOnly, "File Deletion")
result = MsgBox("Yes to Delete Files" & vbCrLf & "NO ONLY View Files", vbYesNo, "File Deletion")
If result = MsgBoxResult.Yes Then
For Each fileName As String In Directory.GetFiles(folderPath)
Dim dirInfo As New DirectoryInfo(fileName)
Dim fC As String = fileName.Replace(folderPath, String.Empty)
If fC.Substring(0, 1) = "f" Then
lstFiles.Items.Add(fileName.Replace(folderPath, String.Empty))
My.Computer.FileSystem.DeleteFile(fileName, FileIO.UIOption.OnlyErrorDialogs, FileIO.RecycleOption.SendToRecycleBin, FileIO.UICancelOption.ThrowException)
End If
Next
MsgBox("Files Deleted", vbOKOnly, "File Deletion")
ElseIf result = MsgBoxResult.No Then
Dim file As String = folderPath.Replace(folderPath, String.Empty)
For Each file In files
Dim fileName As String = Path.GetFileName(file)
lstFiles.Items.Add(fileName)
Next
End If
'Exit Sub
Else
MsgBox("NO Files With" & " f " & "FOUND", vbOKOnly, "File Deletion")
End If
Catch ex As UnauthorizedAccessException
MessageBox.Show("Access to the folder is denied.")
Catch ex As DirectoryNotFoundException
MessageBox.Show("The specified folder does not exist.")
Catch ex As Exception
MessageBox.Show("An error occurred: " & ex.Message)
End Try
End Sub
Private Sub btnDelTemp_Click(sender As Object, e As EventArgs) Handles btnDelTemp.Click
Dim folderPath As String = "C:UsersDwightAppDataLocalTemp"
Dim result As MsgBoxResult = Nothing
' Get all files in the folder that start with "dd"
Dim files As String() = Directory.GetFiles(folderPath, "dd*")
lstFiles.Items.Clear()
' Check if any files are found
If files.Length = 0 Then
result = MsgBox("No Files to Delete", vbOKOnly, "File Deletion")
Exit Sub
End If
result = MsgBox("Yes to Delete Files" & vbCrLf & "NO to EXIT", vbYesNo, "File Deletion")
If result = MsgBoxResult.Yes Then
For Each file As String In files
lstFiles.Items.Add(file.Replace(folderPath, String.Empty))
' Send file to recycle bin
My.Computer.FileSystem.DeleteFile(file, FileIO.UIOption.OnlyErrorDialogs, FileIO.RecycleOption.SendToRecycleBin, FileIO.UICancelOption.ThrowException)
Next
MsgBox("Files Deleted", vbOKOnly, "File Deletion")
ElseIf result = MsgBoxResult.No Then
MsgBox("NO Files DELETED", vbOKOnly, "File Deletion")
Exit Sub
End If
End Sub
Private Sub btnOpenRB_Click(sender As Object, e As EventArgs) Handles btnOpenRB.Click
lstFiles.Items.Clear()
Dim userSid As String = WindowsIdentity.GetCurrent().User.Value
' Construct the path to the Recycle Bin for the current user
Dim recycleBinPath As String = String.Format("C:$Recycle.Bin{0}", userSid)
' Start a new process to open Windows Explorer at the Recycle Bin path
Process.Start("explorer.exe", recycleBinPath)
End Sub
</code>
<code>Public Class frmStart Public Sub frmStart_KeyPress(sender As Object, e As KeyPressEventArgs) Handles Me.KeyPress If Asc(e.KeyChar) = 27 Then Application.Exit() End If End Sub Private Sub btnVCache_Click(sender As Object, e As EventArgs) Handles btnVCache.Click lstFiles.Items.Clear() Dim folderPath As String = "C:UsersDwightAppDataLocalGoogleChromeUser DataDefaultCacheCache_Data" Process.Start(folderPath) 'Me.WindowState = FormWindowState.Minimized End Sub Private Sub btnVTemp_Click(sender As Object, e As EventArgs) Handles btnVTemp.Click lstFiles.Items.Clear() Dim folderPath As String = "C:UsersDwightAppDataLocalTemp" Process.Start(folderPath) End Sub Private Sub btnDelCache_Click(sender As Object, e As EventArgs) Handles btnDelCache.Click Dim folderPath As String = "C:UsersDwightAppDataLocalGoogleChromeUser DataDefaultCacheCache_Data" Dim filePattern As String = "f*" Dim result As MsgBoxResult = Nothing Dim files As IEnumerable(Of String) = Directory.EnumerateFiles(folderPath, filePattern) lstFiles.Items.Clear() 'WORKS where to use it and HOW TO USE Try If files.Any() Then MsgBox("Files Found", vbOKOnly, "File Deletion") result = MsgBox("Yes to Delete Files" & vbCrLf & "NO ONLY View Files", vbYesNo, "File Deletion") If result = MsgBoxResult.Yes Then For Each fileName As String In Directory.GetFiles(folderPath) Dim dirInfo As New DirectoryInfo(fileName) Dim fC As String = fileName.Replace(folderPath, String.Empty) If fC.Substring(0, 1) = "f" Then lstFiles.Items.Add(fileName.Replace(folderPath, String.Empty)) My.Computer.FileSystem.DeleteFile(fileName, FileIO.UIOption.OnlyErrorDialogs, FileIO.RecycleOption.SendToRecycleBin, FileIO.UICancelOption.ThrowException) End If Next MsgBox("Files Deleted", vbOKOnly, "File Deletion") ElseIf result = MsgBoxResult.No Then Dim file As String = folderPath.Replace(folderPath, String.Empty) For Each file In files Dim fileName As String = Path.GetFileName(file) lstFiles.Items.Add(fileName) Next End If 'Exit Sub Else MsgBox("NO Files With" & " f " & "FOUND", vbOKOnly, "File Deletion") End If Catch ex As UnauthorizedAccessException MessageBox.Show("Access to the folder is denied.") Catch ex As DirectoryNotFoundException MessageBox.Show("The specified folder does not exist.") Catch ex As Exception MessageBox.Show("An error occurred: " & ex.Message) End Try End Sub Private Sub btnDelTemp_Click(sender As Object, e As EventArgs) Handles btnDelTemp.Click Dim folderPath As String = "C:UsersDwightAppDataLocalTemp" Dim result As MsgBoxResult = Nothing ' Get all files in the folder that start with "dd" Dim files As String() = Directory.GetFiles(folderPath, "dd*") lstFiles.Items.Clear() ' Check if any files are found If files.Length = 0 Then result = MsgBox("No Files to Delete", vbOKOnly, "File Deletion") Exit Sub End If result = MsgBox("Yes to Delete Files" & vbCrLf & "NO to EXIT", vbYesNo, "File Deletion") If result = MsgBoxResult.Yes Then For Each file As String In files lstFiles.Items.Add(file.Replace(folderPath, String.Empty)) ' Send file to recycle bin My.Computer.FileSystem.DeleteFile(file, FileIO.UIOption.OnlyErrorDialogs, FileIO.RecycleOption.SendToRecycleBin, FileIO.UICancelOption.ThrowException) Next MsgBox("Files Deleted", vbOKOnly, "File Deletion") ElseIf result = MsgBoxResult.No Then MsgBox("NO Files DELETED", vbOKOnly, "File Deletion") Exit Sub End If End Sub Private Sub btnOpenRB_Click(sender As Object, e As EventArgs) Handles btnOpenRB.Click lstFiles.Items.Clear() Dim userSid As String = WindowsIdentity.GetCurrent().User.Value ' Construct the path to the Recycle Bin for the current user Dim recycleBinPath As String = String.Format("C:$Recycle.Bin{0}", userSid) ' Start a new process to open Windows Explorer at the Recycle Bin path Process.Start("explorer.exe", recycleBinPath) End Sub </code>
Public Class frmStart
Public Sub frmStart_KeyPress(sender As Object, e As KeyPressEventArgs) Handles Me.KeyPress
    If Asc(e.KeyChar) = 27 Then
        Application.Exit()
    End If
End Sub

Private Sub btnVCache_Click(sender As Object, e As EventArgs) Handles btnVCache.Click

    lstFiles.Items.Clear()

    Dim folderPath As String = "C:UsersDwightAppDataLocalGoogleChromeUser DataDefaultCacheCache_Data"
    Process.Start(folderPath)
    'Me.WindowState = FormWindowState.Minimized

End Sub

Private Sub btnVTemp_Click(sender As Object, e As EventArgs) Handles btnVTemp.Click

    lstFiles.Items.Clear()

    Dim folderPath As String = "C:UsersDwightAppDataLocalTemp"
    Process.Start(folderPath)

End Sub

Private Sub btnDelCache_Click(sender As Object, e As EventArgs) Handles btnDelCache.Click

    Dim folderPath As String = "C:UsersDwightAppDataLocalGoogleChromeUser DataDefaultCacheCache_Data"
    Dim filePattern As String = "f*"
    Dim result As MsgBoxResult = Nothing
    Dim files As IEnumerable(Of String) = Directory.EnumerateFiles(folderPath, filePattern)

    lstFiles.Items.Clear() 'WORKS where to use it and HOW TO USE
    Try

        If files.Any() Then

            MsgBox("Files Found", vbOKOnly, "File Deletion")

            result = MsgBox("Yes to Delete Files" & vbCrLf & "NO ONLY View Files", vbYesNo, "File Deletion")

            If result = MsgBoxResult.Yes Then

                For Each fileName As String In Directory.GetFiles(folderPath)
                    Dim dirInfo As New DirectoryInfo(fileName)
                    Dim fC As String = fileName.Replace(folderPath, String.Empty)

                    If fC.Substring(0, 1) = "f" Then
                        lstFiles.Items.Add(fileName.Replace(folderPath, String.Empty))
                        My.Computer.FileSystem.DeleteFile(fileName, FileIO.UIOption.OnlyErrorDialogs, FileIO.RecycleOption.SendToRecycleBin, FileIO.UICancelOption.ThrowException)
                    End If

                Next

                MsgBox("Files Deleted", vbOKOnly, "File Deletion")

            ElseIf result = MsgBoxResult.No Then

                Dim file As String = folderPath.Replace(folderPath, String.Empty)
                For Each file In files
                    Dim fileName As String = Path.GetFileName(file)
                    lstFiles.Items.Add(fileName)
                Next

            End If
            'Exit Sub
        Else
            MsgBox("NO Files With" & "   f   " & "FOUND", vbOKOnly, "File Deletion")

        End If
    Catch ex As UnauthorizedAccessException
        MessageBox.Show("Access to the folder is denied.")
    Catch ex As DirectoryNotFoundException
        MessageBox.Show("The specified folder does not exist.")
    Catch ex As Exception
        MessageBox.Show("An error occurred: " & ex.Message)
    End Try
End Sub

Private Sub btnDelTemp_Click(sender As Object, e As EventArgs) Handles btnDelTemp.Click

    Dim folderPath As String = "C:UsersDwightAppDataLocalTemp"
    Dim result As MsgBoxResult = Nothing
    ' Get all files in the folder that start with "dd"
    Dim files As String() = Directory.GetFiles(folderPath, "dd*")

    lstFiles.Items.Clear()

    ' Check if any files are found
    If files.Length = 0 Then
        result = MsgBox("No Files to Delete", vbOKOnly, "File Deletion")
        Exit Sub
    End If

    result = MsgBox("Yes to Delete Files" & vbCrLf & "NO to EXIT", vbYesNo, "File Deletion")
    If result = MsgBoxResult.Yes Then
        For Each file As String In files
            lstFiles.Items.Add(file.Replace(folderPath, String.Empty))
            ' Send file to recycle bin
            My.Computer.FileSystem.DeleteFile(file, FileIO.UIOption.OnlyErrorDialogs, FileIO.RecycleOption.SendToRecycleBin, FileIO.UICancelOption.ThrowException)

        Next

        MsgBox("Files Deleted", vbOKOnly, "File Deletion")
    ElseIf result = MsgBoxResult.No Then
        MsgBox("NO Files DELETED", vbOKOnly, "File Deletion")
        Exit Sub
    End If
End Sub

Private Sub btnOpenRB_Click(sender As Object, e As EventArgs) Handles btnOpenRB.Click

    lstFiles.Items.Clear()

    Dim userSid As String = WindowsIdentity.GetCurrent().User.Value

    ' Construct the path to the Recycle Bin for the current user
    Dim recycleBinPath As String = String.Format("C:$Recycle.Bin{0}", userSid)

    ' Start a new process to open Windows Explorer at the Recycle Bin path
    Process.Start("explorer.exe", recycleBinPath)

End Sub

End Class

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật