delete files which are more than one month old using c# -
How to delete files older than one month using C # script I am using Frame 2.0.
string path = @ "C: \ temp \"; // "Directory Info dirInfo = new DirectoryInfo (path); FileInfo [] fileInfos = dirInfo.GetFiles (); foreach (fileInfo fileInfos in fileInfos) {if (fileInfo.LastWriteTime & date; DateTime.Now.AddMonths (-1)) fileInfo Delete ();}
Comments
Post a Comment