Find files in a folder by their last modified date
Search a folder for files older than a specific number of days
How to find older files in a folder
This is a way to find older files that for example, could be archived or deleted.
Use the System.IO.Directory class to find all files in a folder.
Then for each file, use the LastWriteTime property and compare to the current date to determine if the number of Days is greater than a certain time period.
Once the file is identified, process the file.
var strDirectory = System.IO.Path.GetDirectoryName(strFullPath);
foreach (System.IO.FileInfo file in new System.IO.DirectoryInfo(strDirectory).GetFiles("*.*"))
if ((DateTime.Now - file.LastWriteTime).Days >= 30)