用FINDFIRST,FINDNEXT试试 function FindFirst(const Path: string; Attr: Integer; var F: TSearchRec): Integer;type TSearchRec = record Time: Integer; Size: Integer; Attr: Integer; Name: TFileName; ExcludeAttr: Integer; FindHandle: THandle; FindData: TWin32FindData; end;令Name:='sp1600??.631'
var sr: TSearchRec; begin if findfirst('f:\Sp1600??.633',faAnyFile,sr)=0 then showmessage(sr.Name); while FindNext(sr) = 0 do showmessage(sr.Name); //通过sr可以取得文件名 FindClose(sr); end;
function FileSearch(const Name, DirList: string): string;
datetostr(filedatetodatetime(fileage('sp1600??.631')))=datetostr(now)
就是无法读取sp1600??.631。
换个说法,在知道这个文件确实存在的前提下,如何得知具体的文件名,这样问题就解决了。
各位高手,想想办法!
function FindFirst(const Path: string; Attr: Integer; var F: TSearchRec): Integer;type
TSearchRec = record
Time: Integer;
Size: Integer;
Attr: Integer;
Name: TFileName;
ExcludeAttr: Integer;
FindHandle: THandle;
FindData: TWin32FindData;
end;令Name:='sp1600??.631'
sr: TSearchRec;
begin
if findfirst('f:\Sp1600??.633',faAnyFile,sr)=0 then
showmessage(sr.Name);
while FindNext(sr) = 0 do
showmessage(sr.Name); //通过sr可以取得文件名
FindClose(sr);
end;