How to create subfolder by FtpWebRequest in .net2.0?
C#
2
Posts
2
Posters
0
Views
1
Watching
-
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
-
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