在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
function TFtpContentThd.DeleteDirectory(NowPath: string): Boolean; var search: TSearchRec; ret: integer; key: string; begin if NowPath[Length(NowPath)] <> '\' then NowPath := NowPath + '\'; key := NowPath + '*.*'; ret := findFirst(key, faanyfile, search); while ret = 0 do begin if ((search.Attr and fadirectory) = fadirectory) then begin if (search.Name <> '.') and (search.name <> '..') then begin DeleteDirectory(NowPath + search.name); removedir(NowPath + search.name); //如果需要删除文件夹则添加 end; end else begin if ((search.Attr and fadirectory) <> fadirectory) then begin deletefile(PAnsiChar(NowPath + search.name)); end; end; ret := FindNext(search); end; FindClose(search.FindHandle); //FindClose(search); //发现在线程里面不能用这,只能用上面的句柄 //removedir(NowPath); //如果需要删除最外层文件夹则添加 result := True; end;
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论