本文整理自网络,侵删。
function DeleteDirectory(NowPath: string): Boolean; // 删除整个目录var f : TSearchRec; ret: integer; key: string;
begin if not DeleteTree(NowPath) then begin if NowPath[Length(NowPath)] <> '\' then NowPath := NowPath + '\'; key := NowPath + '*.*'; ret := FindFirst(key, faAnyFile, f); while ret = 0 do begin if ((f.Attr and fadirectory) = fadirectory) then begin if (f.Name <> '.') and (f.name <> '..') then DeleteDirectory(NowPath + f.name); end else begin if ((f.Attr and fadirectory) <> fadirectory) then begin deletefile(NowPath + f.name); end; end; ret := FindNext(f); end; findClose(f);
removedir(NowPath);// 如果需要删除文件夹则添加 result := True; end;end; 相关阅读 >>
Delphi 7zip 示例调用7z.dll 压缩及解压.7z文件
Delphi使用idhttp.get('') 造成假死(堵塞),请问线程idhttp怎么才能做到不出错?
更多相关阅读请进入《Delphi》频道 >>