Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. How to copy a folder in FTP

How to copy a folder in FTP

Scheduled Pinned Locked Moved C / C++ / MFC
helptutorial
8 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    Vivek krishna
    wrote on last edited by
    #1

    I checked many functions to do the same but i could not... i want the help to copy a folder and a file to another folder using a FTP connection... can any one help to do the same...awaiting your reply

    T A 2 Replies Last reply
    0
    • V Vivek krishna

      I checked many functions to do the same but i could not... i want the help to copy a folder and a file to another folder using a FTP connection... can any one help to do the same...awaiting your reply

      T Offline
      T Offline
      ThatsAlok
      wrote on last edited by
      #2

      Vivek krishna wrote:

      . i want the help to copy a folder and a file to another folder using a FTP connection... can any one help to do the same...awaiting your reply

      there is no such function exist in Unmanaged VC++. you have to implement the logic urself for same, i.e. you have to create directory on remote servers ( CFtpConnection::CreateDirectory) and using CFtpConnection::PutFile you can recursivly put file on remote server!

      "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

      cheers, Alok Gupta VC Forum Q&A :- I/ IV

      V 1 Reply Last reply
      0
      • V Vivek krishna

        I checked many functions to do the same but i could not... i want the help to copy a folder and a file to another folder using a FTP connection... can any one help to do the same...awaiting your reply

        A Offline
        A Offline
        andy179394
        wrote on last edited by
        #3

        hi, i also facing the same problem, how i can connect to the FTP Server and also get the file and save the file in server?? is the connection using CFtpConnection? and where can i get the references...:doh: have a nice day :)

        H 1 Reply Last reply
        0
        • A andy179394

          hi, i also facing the same problem, how i can connect to the FTP Server and also get the file and save the file in server?? is the connection using CFtpConnection? and where can i get the references...:doh: have a nice day :)

          H Offline
          H Offline
          Hamid Taebi
          wrote on last edited by
          #4

          You can see this here[^] and also see example ftp in MSDN

          1 Reply Last reply
          0
          • T ThatsAlok

            Vivek krishna wrote:

            . i want the help to copy a folder and a file to another folder using a FTP connection... can any one help to do the same...awaiting your reply

            there is no such function exist in Unmanaged VC++. you have to implement the logic urself for same, i.e. you have to create directory on remote servers ( CFtpConnection::CreateDirectory) and using CFtpConnection::PutFile you can recursivly put file on remote server!

            "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

            cheers, Alok Gupta VC Forum Q&A :- I/ IV

            V Offline
            V Offline
            Vivek krishna
            wrote on last edited by
            #5

            i tried the same but what happens is the file copies separately in the same place where the new folder created not inside the created folder.

            //connection..
            pConnect = sess.GetFtpConnection(m_host,
            m_user,m_pswd,atoi(m_port),false);

            // use a file find object to enumerate files
            CFtpFileFind finder(pConnect);
            pConnect->CreateDirectory("sample");
            // start looping
            BOOL bWorking = finder.FindFile(_T("*"));
            strFileName += m_host;
            strFileName += finder.GetRoot();

               MessageBox(strFileName);
               
            BOOL bUploaded = pConnect->PutFile("C:/070206\_NewVExls.xls",
                           "ss",FTP\_TRANSFER\_TYPE\_BINARY,1);
            	if(bUploaded==0)
            		 MessageBox("unsucess");
            
            I T 2 Replies Last reply
            0
            • V Vivek krishna

              i tried the same but what happens is the file copies separately in the same place where the new folder created not inside the created folder.

              //connection..
              pConnect = sess.GetFtpConnection(m_host,
              m_user,m_pswd,atoi(m_port),false);

              // use a file find object to enumerate files
              CFtpFileFind finder(pConnect);
              pConnect->CreateDirectory("sample");
              // start looping
              BOOL bWorking = finder.FindFile(_T("*"));
              strFileName += m_host;
              strFileName += finder.GetRoot();

                 MessageBox(strFileName);
                 
              BOOL bUploaded = pConnect->PutFile("C:/070206\_NewVExls.xls",
                             "ss",FTP\_TRANSFER\_TYPE\_BINARY,1);
              	if(bUploaded==0)
              		 MessageBox("unsucess");
              
              I Offline
              I Offline
              Iain Clarke Warrior Programmer
              wrote on last edited by
              #6

              Vivek krishna wrote:

              I tried the same but what happens is the file copies separately in the same place where the new folder created not inside the created folder.

              You need to change directory on the remote server, otherwise it won't know you need to put the files in a different place. FTP does not stand for File Transfer (Psychic). Iain,

              V 1 Reply Last reply
              0
              • I Iain Clarke Warrior Programmer

                Vivek krishna wrote:

                I tried the same but what happens is the file copies separately in the same place where the new folder created not inside the created folder.

                You need to change directory on the remote server, otherwise it won't know you need to put the files in a different place. FTP does not stand for File Transfer (Psychic). Iain,

                V Offline
                V Offline
                Vivek krishna
                wrote on last edited by
                #7

                i tried to change directory using "SerCurrentDirectory()". but i m not able to change

                1 Reply Last reply
                0
                • V Vivek krishna

                  i tried the same but what happens is the file copies separately in the same place where the new folder created not inside the created folder.

                  //connection..
                  pConnect = sess.GetFtpConnection(m_host,
                  m_user,m_pswd,atoi(m_port),false);

                  // use a file find object to enumerate files
                  CFtpFileFind finder(pConnect);
                  pConnect->CreateDirectory("sample");
                  // start looping
                  BOOL bWorking = finder.FindFile(_T("*"));
                  strFileName += m_host;
                  strFileName += finder.GetRoot();

                     MessageBox(strFileName);
                     
                  BOOL bUploaded = pConnect->PutFile("C:/070206\_NewVExls.xls",
                                 "ss",FTP\_TRANSFER\_TYPE\_BINARY,1);
                  	if(bUploaded==0)
                  		 MessageBox("unsucess");
                  
                  T Offline
                  T Offline
                  ThatsAlok
                  wrote on last edited by
                  #8

                  Vivek krishna wrote:

                  BOOL bUploaded = pConnect->PutFile("C:/070206_NewVExls.xls", "ss",FTP_TRANSFER_TYPE_BINARY,1); if(bUploaded==0) MessageBox("unsucess");

                  Please give Folder path as argument instead of string "SS"

                  "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

                  cheers, Alok Gupta VC Forum Q&A :- I/ IV

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups