本文整理自网络,侵删。
procedure Deletefiles(APath, AFileSpec: string); //*.txt *.*var lSearchRec:TSearchRec; lFind:integer; lPath:string; dirname: string;begin lPath := IncludeTrailingPathDelimiter(APath); if DirectoryExists(lPath) then begin lFind := FindFirst(lPath+AFileSpec,faAnyFile,lSearchRec); while lFind = 0 do begin dirname := lSearchRec.Name; if (dirName <> '.') and (dirName <> '..') and (FileExists(lPath+dirName)) then begin
DeleteFile(lPath+dirname);
end;
lFind := FindNext(lSearchRec); end; FindClose(lSearchRec); end;end;
相关阅读 >>
Delphi xe 使用savestate保存firemonkey状态的示例
Delphi 中让嵌入窗体的 webbrowser 控件无边框
更多相关阅读请进入《Delphi》频道 >>