Copying Files
-
Hi, I want to copy only CSV files from a folder. I just want copy files tht only modified within one hour. Example time now 11pm. I only want to copy files tht had been available in folder from 10 am to 11 am. I tried using following codes but it does not work as i requested.... string Folder = Server.MapPath("SaveFile"); string CurrLocation = "c:\\Current"; string[] List = Directory.GetFiles(CurrLocation, "*.CSV"); foreach (string CSV in List) { FileInfo CSVInfo = new FileInfo(CSV); if (CSVInfo.LastWriteTime < DateTime.Now.AddMinutes(-60)) { CSVInfo.CopyTo(Folder); } } regards, usha
-
Hi, I want to copy only CSV files from a folder. I just want copy files tht only modified within one hour. Example time now 11pm. I only want to copy files tht had been available in folder from 10 am to 11 am. I tried using following codes but it does not work as i requested.... string Folder = Server.MapPath("SaveFile"); string CurrLocation = "c:\\Current"; string[] List = Directory.GetFiles(CurrLocation, "*.CSV"); foreach (string CSV in List) { FileInfo CSVInfo = new FileInfo(CSV); if (CSVInfo.LastWriteTime < DateTime.Now.AddMinutes(-60)) { CSVInfo.CopyTo(Folder); } } regards, usha