We have a asp.net,C# application in which there is a requirement to get all the files whose date modified will be b/w startdate and enddate . How can we achieve this ? Also want to get all the files not modified for last 3 months ?
According to this post, you could do this:
var directory = new DirectoryInfo(your_dir);
DateTime from_date = DateTime.Now.AddMonths(-3);
DateTime to_date = DateTime.Now;
var files = directory.GetFiles()
.Where(file=>file.LastWriteTime >= from_date && file.LastWriteTime <= to_date);