I've searched the forum and the entire internet and I've had no luck in trying to set the file creation date, and the modified date. function FileSetDateUTF8 should work but it doesn't actually appear to change anything and I want to change both the file age and the modified to different date times.
I found :-
function SetFileDate(const aFilename: string; aDate: TDateTime): boolean;
var
fileHandle: THandle;
fileTime: TFILETIME;
LFileTime: TFILETIME;
LSysTime: TSystemTime;
begin
Result:=False;
try
DecodeDate(aDate, LSysTime.Year, LSysTime.Month, LSysTime.Day);
DecodeTime(aDate, LSysTime.Hour, LSysTime.Minute, LSysTime.Second, LSysTime.Millisecond);
if SystemTimeToFileTime(LSysTime, LFileTime) then
begin
if LocalFileTimeToFileTime(LFileTime, fileTime) then
begin
fileHandle:=FileOpenUTF8(aFilename, fmOpenReadWrite or fmShareExclusive);
if SetFileTime(fileHandle, fileTime, fileTime, fileTime) then
Result:=True;
end;
end;
finally
FileClose(fileHandle);
end;
end;
That seems to just blank the modified date, (reporting in windows).
But I have no idea how to make that work either, windows calls are not my forte. Any one would like to take pity on a noob?