Starting a new career can be overwhelming. Becoming certified in your field of expertise is a great start, but where do you go from here? Here are some tips to help you on your career journey.
Private Sub deleteFilesFiles() Try Dim appPath As String = Application.StartupPath Dim strPath As String strPath = Trim(File.ReadAllLines(Path.GetFullPath("directorypath.txt")).First()) '"C:\Program FIles\" Dim di As New System.IO.DirectoryInfo(strPath) Dim files As New List(Of System.IO.FileInfo) files.AddRange(di.GetFiles()) files.Sort(AddressOf SortFilesDescendingByLastWriteTime) Dim newestFile As System.IO.FileInfo = files(0) Dim dtYear = newestFile.LastWriteTime.DayOfYear Dim DeleteDate = DateAdd(DateInterval.Day, -2, newestFile.LastWriteTime) For Each file In files If file.LastWriteTime < DeleteDate Then file.Delete() End If Next Catch ex As Exception End Try End Sub Private Function SortFilesDescendingByLastWriteTime(ByVal fiA As System.IO.FileInfo, ByVal fiB As System.IO.FileInfo) As Integer Return fiB.LastWriteTime.CompareTo(fiA.LastWriteTime) End Function
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.