如何下载服务器上的一个文件夹里的所有文件?谢谢!!最好给个程序。

解决方案 »

  1.   

    我也急切需要这方面的帮助,兄弟,搞到手后给我一分,[email protected],谢谢
    我有段代码,不过有下面的问题,你看看能否调通(错误:nmftp1.FTPDirectoryList.name.Count恒为0),我这方面懂的不多,兄弟多帮助。
    我另外开个帖子,100分激情相赠解决者(有新的方法也行,最好给个例子)function tftp.ex_download(remote_dir,local_dir:string):boolean;
    var
        i,j,count1:integer;
        att,ss:string;
        current_dir:string;
        temp_dir:string;
    begin
        try begin
            NMFTP1.ChangeDir(remote_dir);
            current_dir:=remote_dir;
            temp_dir:=copy(current_dir,2,length(current_dir));
            if not DirectoryExists(local_dir) then CreateDir(local_dir);
            if not directoryexists(local_dir+temp_dir) then createdir(local_dir+temp_dir);
            nmftp1.ParseList:=true;
            NMftp1.list;
            count1:=nmftp1.FTPDirectoryList.name.Count;
            for i:=0 to count1-1  do begin
                
                NMFTP1.ChangeDir(current_dir);
                nmftp1.list;
                ss:=nmftp1.FTPDirectoryList.name.Strings[i];
                att:=nmftp1.FTPDirectoryList.Attribute.Strings[i];
                if (copy(pchar(att),1,1)<>'d')and(copy(pchar(att),1,1)<>'D') then begin
                    if not DirectoryExists(local_dir) then CreateDir(local_dir);
                    NMFTP1.Download(current_dir+ss,local_dir+temp_dir+ss);
                end
                else begin
                    if not directoryexists(local_dir+temp_dir+ss) then createdir(local_dir+temp_dir+ss);
                    
                    ex_download(remote_dir+ss+'\',local_dir);
                end;
            end;
               result:=true;
        end
        except
        On E:Exception do begin
            result:=false;
        end;
        end;
    end;
      

  2.   

    好的,我先搞出来一定告诉你。你先搞出来也给我个文件。[email protected]
      

  3.   

    老大,整出来了,不过我换D7了,用他自带的InDy,和上面的那段NMFTP源码差不多,你可对着改改。DEMO我给你发到你的邮箱里面去。
      

  4.   

    老哥你给我发的RAR文件我解压不了。说是文件错误。怎么办,你是用7。0做的。请问winexec('iexplore'+'http://youlianchina.com/lxm/index.dcr',sw_hide);是下载一个文件的吗?谢谢你!!
      

  5.   

    winexec不是下载文件的,是调用其他程序的,你使用这段代码其实就是访问网页,然后下载
    可以用winexec调用其他控制台命令,有时候很省事的