#1 fix by using copy strategy overwrite on change
This commit is contained in:
parent
5b4c51eca0
commit
f6e900f292
1 changed files with 21 additions and 2 deletions
|
@ -43,8 +43,27 @@ namespace SynologyCertificateExporter.Services
|
|||
var cpFrom = _synoDirectory + "/" + certificate.Name + "/" + fileName;
|
||||
var cpTo = exportDirectory + "/" + fileName;
|
||||
|
||||
Console.WriteLine($"Copy file from {cpFrom} to {cpTo}");
|
||||
File.Copy(cpFrom, cpTo);
|
||||
if (File.Exists(cpTo))
|
||||
{
|
||||
var cpFromFileInfo = new FileInfo(cpFrom);
|
||||
var cpToFileInfo = new FileInfo(cpTo);
|
||||
|
||||
if (cpFromFileInfo.CreationTime != cpToFileInfo.CreationTime)
|
||||
{
|
||||
Console.WriteLine($"Copy file from {cpFrom} to {cpTo} with overwrite because creationtime changed");
|
||||
|
||||
File.Copy(cpFrom, cpTo, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine($"Skipping copy from {cpFrom} to {cpTo}");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine($"Copy file from {cpFrom} to {cpTo}");
|
||||
File.Copy(cpFrom, cpTo);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue