izak izak

izak izak

  • NA
  • 9
  • 1.9k

Copy files older than x-h

Apr 6 2014 5:17 PM

How do I copy the files to the destinationPath ???



string directoryPath = @"C:\Logs";
string destinationPath = @"D:\BackupLogs";
var files = new DirectoryInfo(directoryPath).GetFiles("*.log");          
foreach (var file in files.Where(file => DateTime.UtcNow - file.CreationTimeUtc > TimeSpan.FromHours(12)))
{

file.CopyTo(               ); ???

Thanks


Answers (2)