FIX: File creation time is changed to now when file is moved (fixes #2020)

(cherry picked from commit 2bdc88ee2b)
This commit is contained in:
Alexander Koblov 2025-06-15 13:41:18 +03:00
commit e535431caf

View file

@ -978,19 +978,12 @@ begin
end;
if ACopyTime then
try
if not (caoCopyTimeEx in CopyAttributesOptionEx) then
begin
if fpCreationTime in SourceFile.AssignedProperties then
CreationTime:= DateTimeToFileTimeEx(SourceFile.CreationTime)
else begin
CreationTime:= TFileTimeExNull;
end;
LastAccessTime:= DateTimeToFileTimeEx(SourceFile.LastAccessTime);
end
if fpCreationTime in SourceFile.AssignedProperties then
CreationTime:= DateTimeToFileTimeEx(SourceFile.CreationTime)
else begin
CreationTime:= TFileTimeExNull;
LastAccessTime:= TFileTimeExNull;
end;
LastAccessTime:= DateTimeToFileTimeEx(SourceFile.LastAccessTime);
// Copy time from properties because move operation change time of original folder
if not FileSetTimeUAC(TargetFileName, DateTimeToFileTimeEx(SourceFile.ModificationTime),
CreationTime, LastAccessTime) then