bool CServerFileManageHandle::UpFileDir(LPCWSTR szPath, LPCWSTR szRemote) { CFileManage hFileManage; hFileManage.GetFileInfo(szPath); bool bIsOk; {{ std::wstring strRemote = szRemote; if( szRemote[lstrlen(szRemote) -1] != _T('\\') ) strRemote += _T("\\"); bIsOk = CreateDir(strRemote.c_str()); if (!bIsOk) return false; }} for(DWORD i = 0; i < hFileManage.m_Fileinfo.size(); i++) { if(lstrcmp(hFileManage.m_Fileinfo[i].cFileName, _T(".")) == 0) continue; if(lstrcmp(hFileManage.m_Fileinfo[i].cFileName, _T("..")) == 0) continue; std::wstring strPath = szPath; if( szPath[lstrlen(szPath) -1] != _T('\\') ) strPath += _T("\\"); std::wstring strRemote = szRemote; if( szRemote[lstrlen(szRemote) -1] != _T('\\') ) strRemote += _T("\\"); if(hFileManage.m_Fileinfo[i].bIsDir) { strPath += hFileManage.m_Fileinfo[i].cFileName; strPath += _T("\\"); strRemote += hFileManage.m_Fileinfo[i].cFileName; strRemote += _T("\\"); bIsOk = UpFileDir(strPath.c_str(), strRemote.c_str()); if(!bIsOk) return false; } else { strPath += hFileManage.m_Fileinfo[i].cFileName; strRemote += hFileManage.m_Fileinfo[i].cFileName; bIsOk = UpFile(strPath.c_str(), strRemote.c_str()); if(!bIsOk) return false; } } return true; }
void CPpcMainWnd::OnFileUp() { if (!ListView_GetSelectedCount(m_hwndLV)) return; int nCount = ListView_GetItemCount(m_hwndLV); if (ListView_GetItemState(m_hwndLV, 0, LVIS_SELECTED)) return; for (int i = 1; i < nCount; i++) { if (ListView_GetItemState(m_hwndLV, i, LVIS_SELECTED)) UpFile(i); } }