I got a small problem on how to create a directory with subdirectories in a single ftp request
I have a string s
string s = "a/b/c/d"
NOTE : The words between slashes are random and the number of items is unknown.
How to create in the FTP server the directory a/b/c/d ????
The way i'm using to achieve this is to split the string and create a folder for each part using the code below :
var ftpWebRequest = (FtpWebRequest)WebRequest.Create("ftp://domain.com/public_html/a");
ftpWebRequest.Credentials = new NetworkCredential(ftpUsername, ftpPassword);
ftpWebRequest.Method = WebRequestMethods.Ftp.MakeDirectory;
ftpWebRequest.GetResponse();
Then i create the b directory inside a, then c inside b, then d inside c by repeating some code, each time
I tried to type the url directly. like :
var ftpWebRequest = (FtpWebRequest)WebRequest.Create("ftp://doemin.com/public_html/a/b/c/d);
but it doesn't work.
Is there a short way on how can i create a folder with other subdirectories in a one single request ?