是这样吗?copy *.* a:.

解决方案 »

  1.   

    我说的是在Delphi编程中,如何实现?
      

  2.   

    用API函数:
    copyfile
    或自己写程序:
    用两函数就可以解决了
    readblock()
    writeblock()
      

  3.   

    整个目录拷,可包含任意多级子目录:
    procedure CopyDirectoryTree(AHandle: THandle;const AFromDirectory, AToDirectory: String);
    var
      SHFileOpStruct: TSHFileOpStruct;
      FromDir:Pchar;
      ToDir:PChar;
    begin
      GetMem(FromDir,Length(AFromDirectory)+2);
      try
        GetMem(ToDir,Length(AToDirectory)+2);
        try
          fillchar(FromDir^,Length(AFromDirectory)+2,0);
          fillchar(ToDir^,Length(AToDirectory)+2,0);      StrCopy(FromDir,PChar(AFromDirectory));
          StrCopy(ToDir,PChar(AToDirectory));      with SHFileOpStruct do
            begin
            Wnd:=AHandle;
            wFunc:=FO_COPY;
            pFrom:=FromDir;
            pTo:=ToDir;
            //fFlags:=FOF_NOCONFIRMATION or FOF_RENAMEONCOLLISION;
            fFlags:=FOF_NOCONFIRMATION;
            fAnyOperationsAborted:=true;
            hNameMappings:=nil;
            lpszProgressTitle:=nil;
            if SHFileOperation(SHFileOpStruct)<>0 then
              RaiseLastWin32Error;
          end;
        finally
          FreeMem(ToDir,Length(AToDirectory)+2);
        end;
      finally
        FreeMem(FromDir,Length(AFromDirectory)+2);
      end;
    end;