捐赠 | 广告 | 注册 | 发布 | 上传 | 关于我们    
  沪ICP备05001939号 DELPHI盒子 | 盒子论坛 | 盒子文章 | 盒子问答悬赏 | 最新更新 | 论坛检索 | 下载中心 | 高级搜索    
  精品专区 | 繁體中文 | 奖励公告栏 | 直通车账号登陆 | 关闭GOOGLE广告 | 临时留言    
 
广告
评论:可以下载整个目录的简单实现
liyong0775 30508 2007/7/24 12:03:20
不能用
kindows 16345 2005/7/14 15:37:55
 这个代码好像是有问题的,我在本机上试验时,总是出现List index out of bounds(9)的错误
china_Peng 14202 2005/4/22 11:55:29
樓主
A:\B\C
  \D    這樣的目錄不能下載
vagrant2005 13362 2005/3/21 7:57:07
http://www.ddvip.net/program/delphi/index1/59.htm
这个地方的代码更为详细
shling 13253 2005/3/16 1:48:47
http://www.ddvip.net/program/delphi/index1/59.htm
yujiu 13241 2005/3/15 17:47:44
procedure Tf_yrdwfileinfo.FTP_DownloadDir(remote_dir,local_dir:string);         //下载整个目录,并遍历所有子目录  使用clftp
var
i,j,count1:integer;
att,ss:string;
current_dir,remote_dir2,currfile:string;
temp_dir,ftpdir:string;
F:textfile;
diratt:string;
filei:TFtpFileInfo;
lst : TStringList;
begin
      ftpdir:=FtpClient1.HostDirName;
      remote_dir2:=ftpdir+'/'+remote_dir;
      FtpClient1.HostDirName :=remote_dir2;
      //==========刷新目录
      ftprefurbish(False );
      //==========
      current_dir:=remote_dir2;    //主目录
      temp_dir :=remote_dir ;
      if not DirectoryExists(local_dir) then CreateDir(local_dir);
      if not directoryexists(local_dir+'\'+temp_dir) then createdir(local_dir+'\'+temp_dir);

         lst := TStringList.Create;
         lst.LoadFromFile(TEMP_FILE_NAME);
          for i :=2 to lst.Count - 1 do
          begin
          diratt:=lst[i];
          filei:=GetFileInfo(diratt);
          if (copy(filei.Attrib ,1,1)<>'d')  then
          begin
          //if not DirectoryExists(local_dir) then CreateDir(local_dir); //创退本地目录
          //==========下载文件
          ftpclient1.Pwd ;
          currfile:=ftpclient1.DirResult ;
          currfile:=currfile+'/'+filei.FileName ;
          ftpclient1.HostFileName :=currfile;
          Ftpclient1.Binary :=true;
          FtpClient1.TypeSet ;
          ftpclient1.LocalFileName :=local_dir+'\'+temp_dir+'\'+filei.FileName ;
          ftpclient1.Get ;
          Ftpclient1.Binary :=false;
          FtpClient1.TypeSet ;
          //==========
          end
          else
          begin
          if not (filei.Filename ='..') then
          begin
          FTP_DownloadDir(filei.FileName,local_dir+'\'+remote_dir);
          end;
          end;
      end;
lst.Free ;
end;
tim001 13095 2005/3/9 13:47:40
呵呵,谢谢!
第一页 上一页 下一页 最后页 有 7 条纪录 共1页 1 - 7
 用户名:
 密 码:
自动登陆(30天有效)
 
  DELPHI盒子版权所有 1999-2023 V4.01 粤ICP备10103342号-1 更新RSS列表