Recursion
Im trying to upload a directory and all the files in it to a server using wininet.
here is my code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
BOOL CListfilesDlg::recursion(CString sPath) // sPath is the folder name
{
HANDLE hFind;
WIN32_FIND_DATA fdFind;
UpdateData(true);
CString StrPathS = m_editvalue; //m_editvalue has the full path of the folder im viewing in a listcontrol
CString salvation = StrPathS + sPath;
UpdateData(false);
CString ren = salvation + "*.*";
hFind = FindFirstFile( ren, &fdFind );
do
{
if( fdFind.dwFileAttributes == FILE_ATTRIBUTE_DIRECTORY )
{
FtpCreateDirectory(hIConnect,fdFind.cFileName);
UpdateData(true);
CString cov = sPath;
CString fire = m_editvalue;
UpdateData(false);
CString newPath = fire + cov + "\\" + fdFind.cFileName;
recursion(newPath);
}
if(fdFind.dwFileAttributes == FILE_ATTRIBUTE_ARCHIVE)
continue;
else
{
}
}
while( FindNextFile( hFind, &fdFind ) );
return recursion(sPath);
}
| |
Can someone fix the code? I tried debugging with no luck...
Topic archived. No new replies allowed.