Horje
c# delete files older than 10 days Code Example
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();
}
c# delete files older than x months
using System.IO; 

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

foreach (string file in files)
{
   FileInfo fi = new FileInfo(file);
   if (fi.LastAccessTime < DateTime.Now.AddMonths(-3))
      fi.Delete();
}




Csharp

Related
c# get executable path Code Example c# get executable path Code Example
Point to mouse 2D Unity Code Example Point to mouse 2D Unity Code Example
how t remove a component in unity Code Example how t remove a component in unity Code Example
draw sphere gizmo unity Code Example draw sphere gizmo unity Code Example
how to remove a component from an object in unity Code Example how to remove a component from an object in unity Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
8