I think that the MFC classes CInternetSession, CFtpConnection & CFtpFileFind would help you a lot.
A little example:
Code:CInternetSession sess; CFtpConnection* pConnect = NULL; try { pConnect = sess.GetFtpConnection(sFtpServer, sFtpUser, sFtpPassword); } catch (CInternetException* pEx) { return ; } CFtpFileFind finder(pConnect); bFileFound = finder.FindFile("*.*"); if (bFileFound) { finder.FindNextFile(); sFileName = finder.GetFilePath(); BOOL bRes = pConnect->GetFile( sFileName, "MyFileName", FALSE); } if (pConnect != NULL) { pConnect->Close(); delete pConnect; }




Reply With Quote