![]() ![]() VB.NET Private Sub DeleteFilesRecursive(strFolder As String)įor Each dirFolder In Directory.GetDirectories(strFolder)įor Each file In Directory.GetFiles(strFolder)Ī recursive sub or method is a sub or method that calls itself. Let’s add the DeleteFilesRecursive sub now.Ĭ# private void DeleteFilesRecursive(string strFolder)įoreach (var dirFolder in Directory.GetDirectoriesįoreach (var fil in Directory.GetFiles(strFolder)) I then called the DeleteFilesRecursive sub for every folder or file in the list. I created a list object and populated it with all the desired files and folders that contain temporary files for Internet Explorer and Chrome. LstChrome.Add(strLocalApplicationData & "\Google\Chrome _ Private Sub Button2_Click(sender As Object, e As EventArgs) _ĭim lstChrome As List(Of String) = New List(Of String) IEReg = "SOFTWARE\Microsoft\Internet Explorer\TypedURLs" LstIE.Add("SOFTWARE\Microsoft\Internet Explorer\TypedURLs") LstIE.Add(strLocalApplicationData & "\Microsoft\ _ LstIE.Add(strLowLocalApplicationData & "\Microsoft\ _ LstIE.Add(strApplicationData & "\Microsoft\Windows\ _ VB.NET Private Sub Button1_Click(sender As Object, e As EventArgs) _ĭim lstIE As List(Of String) = New List(Of String) LstChrome.Add(strLocalApplicationData + "\\Google\\Ĭhrome\\User Data\\Default\\Local Storage") Private void Button2_Click(object sender, EventArgs e) IEReg = "SOFTWARE\\Microsoft\\Internet Explorer\\ LstIE.Add("SOFTWARE\\Microsoft\\Internet Explorer\\ LstIE.Add(strLocalApplicationData + "\\Microsoft\\ LstIE.Add(strLowLocalApplicationData + "\\Microsoft\\ LstIE.Add(strApplicationData + "\\Microsoft\\Windows\\ These Registry keys contain Visual Studio’s recent file lists and project lists.Īdd the following code to delete Internet Explorer’s and Google Chrome’s temporary files:Ĭ# private void Button1_Click(object sender, EventArgs e) Public strVSProjectMRUList As String = "SOFTWARE\Microsoft _ VB.NET Public strVSFileMRUList As String = "SOFTWARE\Microsoft _ Public string strVSProjectMRUList = "SOFTWARE\\Microsoft\\ That way, you won’t have to retype them every time you need them:Īdd the following variables to store Registry key locations:Ĭ# public string strVSFileMRUList = "SOFTWARE\\Microsoft\\ The preceding few variables store the following locations into memory. SpecialFolder.LocalApplicationData) & "Low" ()ĭim strLowLocalApplicationData As String = Environment _ ![]() ("WINDIR", EnvironmentVariableTarget.Machine)ĭim strApplicationData As String = Environment.GetFolderPath _ GetFolderPath(Environment.SpecialFolder _ĭim strLocalApplicationData As String = Environment _ĭim strWinDir As String = Environment.GetEnvironmentVariable _ VB.NET Dim strCommonApplicationData As String = Environment _ "SOFTWARE\\Microsoft\\VisualStudio\\17.0\\ProjectMRUList" "SOFTWARE\\Microsoft\\VisualStudio\\17.0\\FileMRUList" ![]() String strLowLocalApplicationData = Environment.GetFolderPath String strApplicationData = Environment.GetFolderPath ("WINDIR", EnvironmentVariableTarget.Machine) String strWinDir = Environment.GetEnvironmentVariable String strLocalApplicationData = Environment.GetFolderPath Design the form to look similar to Figure 1.Įnsure you have the following namespaces included in your class.Ĭ# string strCommonApplicationData = Environment.GetFolderPath Open Visual Studio and create either a C# or VB.NET Windows Forms application. With this article, I will show you how easy it is to create a Temp file cleaner. Temporary files: We all have them, and we all hate them, especially when apps are starting to perform poorly or space on the hard drives start to run out. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |