Hi
Here is my attempt to provide a text file containing a list of FullName, CreationTime and LastWriteTime sorted on LastWriteTime from a chosen Directory starting from a chosen Date. I am not very adept in using LINQ, as will probably be obvious, but it seems to work. There may be other better solutions suggested.
Option Strict On
Option Explicit On
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim savePath As String = IO.Path.Combine(My.Computer.FileSystem.SpecialDirectories.Desktop, "Test1.txt")
If Not IO.File.Exists(savePath) Then IO.File.Create(savePath).Close()
Dim dirPath As New IO.DirectoryInfo("C:\Users\lesha\Documents\Projects")
Dim FromDate As Date = Now.AddMonths(-4).Date
Dim dirs = From dir In dirPath.EnumerateDirectories() Where dir.CreationTime > FromDate Order By dir.LastWriteTime Select dir.FullName, dir.CreationTime, dir.LastWriteTime
Using sw As New IO.StreamWriter(savePath, False)
sw.WriteLine("FullName, Creation Time, LastWrite Time")
For i As Integer = 0 To dirs.Count - 1
With dirs(i)
sw.Write(.FullName)
sw.Write(.CreationTime.ToString("dd MMM yyyy"))
sw.WriteLine(.LastWriteTime.ToString("dd MMM yyyy"))
End With
Next
End Using
End Sub
End Class