如何通过程序实现网络文件夹的复制和删除,最好有源码.

解决方案 »

  1.   

    路径:"\\ComputerName\share\some.exe";
    换算:"\\\\ComputerName\\share\\some.exe";
      

  2.   

    wchar_t cstrSrcDir[MAX_PATH] ;
        SHFILEOPSTRUCT aFileOpStruct;
     
        if( strSrcDir==_T(""))
        {
            return false;
        }        wmemset(cstrSrcDir,0, MAX_PATH); 
        wmemcpy(cstrSrcDir, strSrcDir, strSrcDir.GetLength());
        ZeroMemory(&aFileOpStruct, sizeof(SHFILEOPSTRUCT));
        aFileOpStruct.pFrom = cstrSrcDir;
        aFileOpStruct.fFlags = FOF_ALLOWUNDO | FOF_NOCONFIRMATION | FOF_SILENT;
        aFileOpStruct.wFunc = FO_DELETE;//该这个参数就可以实现copy
        return ( SHFileOperation(&aFileOpStruct) == 0 );