如何把一个文件夹考到别的文件夹下!

解决方案 »

  1.   

    The CopyFile function copies an existing file to a new file. BOOL CopyFile(
      LPCTSTR lpExistingFileName,
                              // pointer to name of an existing file
      LPCTSTR lpNewFileName,  // pointer to filename to copy to
      BOOL bFailIfExists      // flag for operation if file exists
    );Parameters
    lpExistingFileName 
    Pointer to a null-terminated string that specifies the name of an existing file. 
    lpNewFileName 
    Pointer to a null-terminated string that specifies the name of the new file. 
    bFailIfExists 
    Specifies how this operation is to proceed if a file of the same name as that specified by lpNewFileName already exists. If this parameter is TRUE and the new file already exists, the function fails. If this parameter is FALSE and the new file already exists, the function overwrites the existing file and succeeds.
      

  2.   

    char  strSrc[]="f:\\temp2\0";
     //可以改变源路径
     char  strDst[]="f:\\temp\0";
     //设置目的路径
     char  strTitle[]="File copying";
     //进度题头
     SHFILEOPSTRUCT FileOp;
     FileOp.hwnd=m_hWnd;
     FileOp.wFunc=FO_COPY;
     //执行文件拷贝
     FileOp.pFrom=strSrc;
     FileOp.pTo=strDst;
     FileOp.fFlags=FOF_ALLOWUNDO;
     FileOp.hNameMappings=NULL;
     FileOp.lpszProgressTitle=strTitle;        nOk=SHFileOperation(&FileOp);
            if(nOk)
                TRACE("There is an error: %d\n",nOk);
            else
               TRACE("SHFileOperation finished successfully\n");         if(FileOp.fAnyOperationsAborted)
                TRACE("Operation was aborted!\n");