资料夹A: \\Pcii001\D\Online Games\NetEase\XYOnline2\
资料夹B: D:\Online Games\NetEase\XYOnline2\
以上两个数据夹做对比然后复制,
1. 仅在数据夹A存在的档案(包含下层数据夹), 由数据夹A复制到数据夹B.
2. 仅在数据夹B存在的档案(包含下层数据夹),则删除.
3. 两个数据夹里时间相同大小不同的档案, 由数据夹A复制到数据夹B.
4. 数据夹A中较新的档案, 由数据夹A复制到数据夹B
5. 数据夹B中较新的档案, 则删除.
6. 空的数据夹, 由数据夹A复制到数据夹B.
7. 设定排除数据夹A中的某些数据夹.

解决方案 »

  1.   

    查查XCOPY命令
    xcopy F:\YJERP \\Portalser\wnxBK\永捷项目\YJERP /d /e /y /f
      

  2.   

    在cmd下运行 "xcopy /?"   看一下语法
      

  3.   

    function GetFolder:string;
    var
      BI: TBrowseInfo;
      Buf: PChar;
      Dir,
      Root: PItemIDList;
      Alloc: IMalloc;
    begin
      result:='';
      SHGetMalloc(Alloc);
      Buf := Alloc.Alloc(Max_Path);  // CSIDL_BITBUCKET  RecycleBin
      // CSIDL_CONTROLS   ControlPanel
      // CSIDL_DESKTOP    Desktop
      // CSIDL_DRIVES     My Computer
      // CSIDL_FONTS      Fonts
      // CSIDL_NETHOOD    Network Neighborhood
      // CSIDL_NETWORK    The virtual version of the above
      // CSIDL_PERSONAL   'Personal'
      // CSIDL_PRINTERS   printers
      // CSIDL_PROGRAMS   Programs in the Start Menu
      // CSIDL_RECENT     Recent Documents
      // CSIDL_SENDTO     Folder SendTo
      // CSIDL_STARTMENU  The whole Start menu
      // CSIDL_STARTUP    The Autostart Group
      // CSIDL_TEMPLATES  Document templates  // use of the constants above
      SHGetSpecialFolderLocation(Application.Handle, CSIDL_DESKTOP, Root);
      with BI do
      begin
        hwndOwner := Form1.Handle;
        // NIL means show all
        pidlRoot := Root;
        pszDisplayName := Buf;
        lpszTitle := '選擇目錄';
        ulFlags := 0;
        lpfn := nil;
      end;  try
        Dir := SHBrowseForFolder(BI);
        if Dir<>nil then
        begin
          SHGetPathFromIDList(Dir, Buf);
          Result:=buf;
          Alloc.Free(Dir);
        end;
      finally
        Alloc.Free(Root);
        Alloc.Free(Buf);
      end;
    end;procedure TForm1.Button6Click(Sender: TObject);
    begin
        LabeledEdit1.Text:=GetFolder+'\';
    end;procedure TForm1.Button7Click(Sender: TObject);
    begin
        LabeledEdit2.Text:=GetFolder+'\';
    end;procedure TForm1.Button8Click(Sender: TObject);
    begin
    winexec(pchar('xcopy.exe "'+LabeledEdit1.text+'*.*" "'+LabeledEdit2.text+'" /W/F/L/E/D/Y'), SW_Hide);
    end;我這樣子copy不了呀...怎樣解決呀!