|
|
Form1.lb_num.Caption := IntToStr(StrToInt(Form1.lb_num.Caption) + 1);
Form1.lb_num.Update;
if i = DirCount - 1 then
begin
idFTP.ChangeDirUp;
idFTP.List(nil);
end;
end;
end;
end;
{删除整个ftp目录,包括下面的文件,
RootDir = 要删除的根目录,一般情况下 RemoteDir 与 RootDir 相等}
procedure FTP_DeleteAllFiles(var idFTP : TIdFtp;RemoteDir,RootDir : string);
label Files;
var
i,DirCount : integer;
Temp : string;
begin
idFTP.ChangeDir(RemoteDir);
if Pos(RootDir,idFTP.RetrieveCurrentDir) = 0 then Exit;
Files :
idFTP.List(nil);
DirCount := idFTP.DirectoryListing.Count ;
while DirCount = 0 do
begin
Temp := idFTP.RetrieveCurrentDir;
idFTP.ChangeDirUp;
idFTP.RemoveDir(Temp);
idFTP.List(nil);
DirCount := idFTP.DirectoryListing.Count ;
for i := 0 to DirCount - 1 do
if idFTP.DirectoryListing[i].FileName = RootDir then Exit;
end;
for i := 0 to DirCount - 1 do
begin
if Pos(RootDir,idFTP.RetrieveCurrentDir) = 0 then Break ;
if idFTP.DirectoryListing[i].ItemType = ditDirectory then
网友评论:(评论内容只代表网友观点,与本站立场无关!) |
阅读排行
没有相关文章
|