Answers for "c# delete files older than 10 days"

C#
1

c# delete files older than 10 days

using System.IO; 

string[] files = Directory.GetFiles(dirName);

foreach (string file in files)
{
   FileInfo fi = new FileInfo(file);
   if (fi.LastAccessTime < DateTime.Now.AddDays(-10))
      fi.Delete();
}
Posted by: Guest on August-11-2020

Code answers related to "c# delete files older than 10 days"

C# Answers by Framework

Browse Popular Code Answers by Language