i have a class public class CloudFileVersion { public int FileVersionID { get; set; } public int CloudFileID { get; set; } public string FileName { get; set; } public string DestinationPath { get; set; } public string FileDate { get; set; } public long FileSize { get; set; } public string CreationDate { get; set; } public int PlanID { get; set; } public string CloudFileName { get; set; } } List<CloudFileVersion> objFileVersionlst iam looping to find old file int deleteDays=10; foreach (var veritem in objFileVersionlst) { DateTime dtver = DateTime.ParseExact(veritem.FileDate, "yyyyMMddhhmmss", CultureInfo.InvariantCulture); int ActualDays = (int)(DateTime.Now.ToUniversalTime() - dtver).TotalDays; if ( ActualDays >= deleteDays) { //delete the file } }
objFileVersionlst.Where(veritem=>(DateTime.Now.ToUniversalTime() - DateTime.ParseExact(veritem.FileDate, "yyyyMMddhhmmss", CultureInfo.InvariantCulture).TotalDays >= deleteDays).ForEach((veritem)=>{ // delete the file });
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)