我想在网络中进行文件夹的拷贝,可是不知道如何实现,还请各位大侠指点指点,小弟不胜感激!!!!!

解决方案 »

  1.   

    简单点的通过网络共享,复杂点的就是遍一个FTP服务器,在客户端上传和下载
      

  2.   

    通过FTP比较合适,还能控制权限
      

  3.   

    自己在写程序过程中用到了TNMFtp,于是就自己写了两个过程,实现下载和上传:
    procedure ex_download(remote_dir,remote_file:string);
    var
    localfname:string;
    begin
     datamodule2.NMFTP1.Connect;
     try  datamodule2.NMFTP1.ChangeDir(remote_dir);
       begin
        if nod='ネマヨ、ニスフィ' then
          localfname:=remote_file
        else
          localfname:=mycaption;
          datamodule2.NMFTP1.Download(remote_file,FRootPath+remote_file);
       end
        except
        On E:Exception do begin
           showmessage('下在失败,请检查文件是否存在,或网络是否已断开');
        end;
       end;
     datamodule2.NMFTP1.Disconnect;
    end;procedure ex_upload(remote_dir:string;atable:tcustomadodataset;fieldname:string);
    var
    remotefname,localfname:string;
    label lab;
    begin
     begin
     datamodule2.NMFTP1.Connect;
     try if not DirectoryExists('ftp://'+trim(sysshezhi.edtAddress.text)+'/'+remote_dir) then
        datamodule2.nmftp1.MakeDirectory(remote_dir);
        except
        On E:Exception do begin
        end;end;
        datamodule2.NMFTP1.ChangeDir(remote_dir);
    lab: if datamodule2.OpenDialog1.Execute then
           begin
            temp_dir:='ftp://'+trim(sysshezhi.edtAddress.Text)+'/'+remote_dir;
            localfname:=datamodule2.OpenDialog1.FileName;
            remotefname:=extractfilename(localfname);
            remotefnam:=remotefname;
            if remotefname='' then
             begin
              showmessage('没选中文件!请重新选择');
              goto lab;
             end
               else
                begin
                 if findfile(atable,remotefnam,fieldname) then
                   begin
                    if MessageDlg('文件已存在,覆盖吗?',mtConfirmation, [mbYes, mbNo], 0) = mrYes then
                      begin
                       bool:=true;
                       ins:=false;
                       datamodule2.NMFTP1.upload(localfname,remotefname);
                      end
                       else
                        begin
                         bool:=false;
                         messagebox(0,'上传取消','提示!',0);
                       end;
                    end;
                 if not findfile(atable,remotefnam,fieldname) then
                   begin
                    bool:=true;ins:=true;
                    datamodule2.NMFTP1.upload(localfname,remotefname);
                   end;
                end;
            end;
     end;
    因为程序时作项目的时候写的,所以里面又TABLE:)
    机制是:本地显示数据库里的内容,数据库里的内容是记录了上传的信息。