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#
  4. How to create subfolder by FtpWebRequest in .net2.0?

How to create subfolder by FtpWebRequest in .net2.0?

Scheduled Pinned Locked Moved C#
csharptutorialquestion
2 Posts 2 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.
  • M Offline
    M Offline
    mimimimilaw
    wrote on last edited by
    #1
        FtpWebRequest reqFTP;
        dirName = "/dir1//dir2//dir3";
        reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri("ftp://" + ip + "/" + dirName));
        reqFTP.Method = WebRequestMethods.Ftp.MakeDirectory;
        this.textBox\_status.Text += WebRequestMethods.Ftp.ListDirectory;
        reqFTP.UseBinary = true;
        reqFTP.Credentials = new NetworkCredential(Username, Password);
        FtpWebResponse response = (FtpWebResponse)reqFTP.GetResponse();
        Stream ftpStream = response.GetResponseStream();
        ftpStream.Close();
        response.Close();
    

    First, how to check the folder exist or not on the FTP? The code can only create a directory in the path can we create multiple directory in the same time? Thanks

    L 1 Reply Last reply
    0
    • M mimimimilaw
          FtpWebRequest reqFTP;
          dirName = "/dir1//dir2//dir3";
          reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri("ftp://" + ip + "/" + dirName));
          reqFTP.Method = WebRequestMethods.Ftp.MakeDirectory;
          this.textBox\_status.Text += WebRequestMethods.Ftp.ListDirectory;
          reqFTP.UseBinary = true;
          reqFTP.Credentials = new NetworkCredential(Username, Password);
          FtpWebResponse response = (FtpWebResponse)reqFTP.GetResponse();
          Stream ftpStream = response.GetResponseStream();
          ftpStream.Close();
          response.Close();
      

      First, how to check the folder exist or not on the FTP? The code can only create a directory in the path can we create multiple directory in the same time? Thanks

      L Offline
      L Offline
      leppie
      wrote on last edited by
      #2

      mimimimilaw wrote:

      dirName = "/dir1//dir2//dir3";

      What's the idea with the double slashes?

      xacc.ide - now with TabsToSpaces support
      IronScheme - 1.0 beta 1 - out now!
      ((lambda (x) `((lambda (x) ,x) ',x)) '`((lambda (x) ,x) ',x))

      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