I need to use a text box with date picker to select the date and based on the selected date when i click on go button sub folders should be created in FTP Folder for that date,month and year that is given in text box.This should be done using windows application can you please tell me how can i do this. This is the code that i had used to display the date in text box and for that date in text box i need to create sub folders in ftp folder that is if in text the date is 05/18/2015 i need sub folder for 05,sub folder for 18 and sub folder for 2015. totally i need 3 sub folders in ftp folder.

public Form1()
            {
                InitializeComponent();
            }
            private void Form1_Load(object sender, EventArgs e)
            {
                dateTimePicker1.Format = DateTimePickerFormat.Short;
                dateTimePicker1.Value = DateTime.Today;
                }
                private void button1_Click(object sender, EventArgs e)
            {
                DateTime iDate;
                iDate = dateTimePicker1.Value;
                string theDate = dateTimePicker1.Value.ToString("MM-dd-yyyy");
             }

when i click button 1 it should create three folders in ftp folder one for date,another for month and another for year.how should i do this to create sub folders in an ftp folder

Recommended Answers

All 2 Replies

Something like this:

    WebRequest request = WebRequest.Create("ftp://example.com/folder");
    request.Method = WebRequestMethods.Ftp.MakeDirectory;
    request.Credentials = new NetworkCredential("username", "password");
    using (FtpWebResponse response = (FtpWebResponse) request.GetResponse())
    {
        Console.WriteLine(response.StatusCode);
    }

This assumes that you have the right permissions to create a folder.

For your request you'll need the above code nested for each folder you want to create.

Great informations thanks for sharing.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.