[C#] FTP series (5) ─ Delete the data box with the specified name on FTP
Continue the previous article [C#] FTP series (4) ─ Change the file on FTP File name article, this time I’m going to share how to delete a specific data box on FTP Server, don’t talk nonsense, let’s check it out now.
On the Server (as shown in the figure below), what you can see is “2011_MVP_Open_Day_success” and “OnlineFolder Strong>” these two folders, now we have deleted the “OnlineFolder” data box through our program.
As shown in the figure below, enter the data box name in the program, and then press Delet Folder Button, and then look at the result? Is OnlineFolder missing?
Program explanation:
Step 1. such as [C#] FTP series (2) ─ Step 1. em> as shown.
Step 2. in the “ Add the following program to the Click event of the Delete Folder” button:
Step 3. Because in Step 2 em> is the method name of RemoveFolder(…), and the method content is as follows:
In addition to creating the FtpWebRequest object in line 128, pass it back to FtpWebRequest through WebRequest.Create(Ftp path location + file name) strong>Object variable,
Line 129 is the input verification of login account/secret.
Line 130 represents the method used RemoveDirectory
Wow! It’s a simple one, two, three, let’s do the function of deleting the directory! ? The next part, the final part, will tell you how to delete files!
Original text: Large column [C#] FTP series (5) ─ Delete the data box with the specified name on the FTP