program FileAgeTest;
{$APPTYPE CONSOLE}
{$R *.res}
uses
System.SysUtils,
System.IOUtils;
procedure Main;
const
NTFSVolume = '
E:\';
// muss ein NTFS-Laufwerk sein
FAT32Volume = '
F:\';
// muss ein FAT32-Laufwerk sein
FileName = '
TestFile.txt';
var
LastWrite: TDateTime;
begin
if TFile.Exists(TPath.Combine(NTFSVolume, FileName))
then
TFile.Delete(TPath.Combine(NTFSVolume, FileName));
if TFile.Exists(TPath.Combine(FAT32Volume, FileName))
then
TFile.Delete(TPath.Combine(FAT32Volume, FileName));
TFile.WriteAllText(TPath.Combine(NTFSVolume, FileName), '
test');
Writeln(DateTimeToStr(TFile.GetLastWriteTime(TPath.Combine(NTFSVolume, FileName))));
TFile.Copy(TPath.Combine(NTFSVolume, FileName),TPath.Combine(FAT32Volume, FileName));
Writeln(DateTimeToStr(TFile.GetLastWriteTime(TPath.Combine(FAT32Volume, FileName))));
LastWrite := System.SysUtils.Now;
TFile.SetLastWriteTime(TPath.Combine(NTFSVolume, FileName),LastWrite);
TFile.SetLastWriteTime(TPath.Combine(FAT32Volume, FileName),LastWrite);
Writeln(DateTimeToStr(TFile.GetLastWriteTime(TPath.Combine(NTFSVolume, FileName))));
Writeln(DateTimeToStr(TFile.GetLastWriteTime(TPath.Combine(FAT32Volume, FileName))));
end;
begin
try
Main;
except
on E:
Exception do
Writeln(E.ClassName, '
: ', E.
Message);
end;
Readln;
end.