Hi Folks
I have a foreach statment that copies files from one directory to another. How do I add in a statement that ensures the files are only copied across if their 'last modified' dates are different? The code looks like this:
string[] ListOfFiles = Directory.GetFiles(strSourceDirectory);
foreach(string fil in ListOfFiles)
{
// The files are copied across to the destination directory
File.Copy(fil, strDestinationDirectory + "\\" + Path.GetFileName(fil));
}
Cheers,
Kenny.
I have a foreach statment that copies files from one directory to another. How do I add in a statement that ensures the files are only copied across if their 'last modified' dates are different? The code looks like this:
string[] ListOfFiles = Directory.GetFiles(strSourceDirectory);
foreach(string fil in ListOfFiles)
{
// The files are copied across to the destination directory
File.Copy(fil, strDestinationDirectory + "\\" + Path.GetFileName(fil));
}
Cheers,
Kenny.