Also ich habe das so gelöst:
Delphi-Quellcode:
function RenameFile(sFileName : string) : string;
var
sjetzt, NewFileName : string;
count : integer;
begin
Result := sFileName;
NewFileName := sFileName;
count := 0;
while SysUtils.FileExists(NewFileName) and (count < 255)
do begin
inc(count);
NewFileName := sFileName;
DateTimeToString(sjetzt, 'dd.mm.yyyy hh_nn_ss', now);
Insert('(' + sjetzt + ')', sFileName, Pos(ExtractFileExt(sFileName), sFileName));
end;
if CompareStr(sFileName , NewFileName) <> 0
then
Result := NewFileName;
end;
Den SaveFiledialog kann man auch auf FileExists kombinieren.
Gruß David