Recursion
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7

Thread: Recursion

Threaded View

  1. #1
    Join Date
    Jun 2013
    Posts
    21

    Recursion

    The code below is suppose to create directories and upload files, but it is not working. What can I do to make the code work?


    Code:
    void CRECURSIONDlg::Recursion(CString sPath)
    {
    
    hInternet = InternetOpen(TEXT("BEAR FTP"),
       INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
    
    // Make sure there are no errors
    hIConnect = InternetConnect(hInternet,"192.168.1.4", 211,
       "******", "*****", INTERNET_SERVICE_FTP, INTERNET_FLAG_PASSIVE, 0);
    
    
    HANDLE hFind;
    WIN32_FIND_DATA fdFind;
    UpdateData(true);
    
    CString salvation = m_path + "\\" + sPath;
    	UpdateData(false);
    
    
    hFind = FindFirstFile( salvation, &fdFind );
    
    
    
    do{
    
    if( fdFind.dwFileAttributes == FILE_ATTRIBUTE_DIRECTORY )
    {
    	FtpCreateDirectory(hIConnect,fdFind.cFileName);
    UpdateData(true);
    CString cov = m_path;
    UpdateData(false);
    CString newPath = cov + "\\" + fdFind.cFileName;
    FtpCreateDirectory(hIConnect,fdFind.cFileName);
    
    Recursion(newPath);
    }
    if(fdFind.dwFileAttributes == FILE_ATTRIBUTE_ARCHIVE)
    continue;
    else
    {
    FtpPutFile(hIConnect,fdFind.cFileName,fdFind.cFileName,FTP_TRANSFER_TYPE_BINARY,NULL);
    
    }
    
    
    
    
    
    
    }while( FindNextFile( hFind, &fdFind ) );
    
    
    }
    Last edited by vaas; July 21st, 2013 at 07:12 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center