Ejemplo n.º 1
0
 private void DelOldErrorLog()
 {
     try
     {
         string path = FileCacheHelper.GetWebRootPath(1, "publics") + @"\LogError";
         if (!Directory.Exists(path))
         {
             Directory.CreateDirectory(path);
         }
         if (Directory.Exists(path))
         {
             FileInfo[] files = new DirectoryInfo(path).GetFiles("*.log");
             DateTime   time2 = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd")).AddDays(-10.0);
             foreach (FileInfo info2 in files)
             {
                 if (info2.CreationTime < time2)
                 {
                     info2.Delete();
                 }
             }
         }
     }
     catch
     {
     }
 }