嘿嘿,我有一个方法,把文件都保存成save00001.bak的形式,Apath为路径,例如“c:/”
function GetFileName:string;
var
FSearchRec,DSearchRec:TSearchRec;
f:file of byte;
Filename:string;
begin
Filename:=string;
findresult:=findfirst(Apath+'save*.bak',faanyfile,fsearchrec);
try
while findresult=0 do
begin
filename:=fsearchrec.Name;
assignfile(f,Apath+fsearchrec.Name);
Reset(f);
closefile(f);
findresult:=findnext(fsearchrec)
end;
findresult:=findfirst(apath+'save*.bak',fadirectory,dsearchrec);
while findresult=0 do
findresult:=findnext(dsearchrec);
finally
findclose(fsearchrec);
end;
if filename='' then
filename:='save000001.bak'
else
filename:='save'+formatfloat('000000',strtoint(copy(filename,5,6))+1)+'.bak';
result:=filename;
end;