I get this error message 'Access to the path 'F:\System Volume Information' is denied.' when I run the code below this text.
How can I ignore 'System Volume Information'?
How can I ignore 'System Volume Information'?
C#:
string[] originalFiles = Directory.GetFiles(sourceFolder, "*", SearchOption.AllDirectories);
Array.ForEach(originalFiles, (originalFileLocation) =>
{
FileInfo originalFile = new FileInfo(originalFileLocation);
FileInfo destFile = new FileInfo(originalFileLocation.Replace(sourceFolder, destiniationFolder));
if (destFile.Exists)
{
if (originalFile.Length > destFile.Length)
{
originalFile.CopyTo(destFile.FullName, true);
}
else
{
Directory.CreateDirectory(destFile.DirectoryName);
originalFile.CopyTo(destFile.FullName, false);
}
});
Last edited by a moderator: