How To Delete Multiple Files In C# Winform Application

Опубликовано: 30 Июнь 2020
на канале: Jebbidan
244
2

my website: https://jebbidan.editorx.io/hadsis-co...
https://jebbidan.wixsite.com/hadsis

the code:

for the code on the list file button: http://www.mediafire.com/file/vi3ty1x...

for the code on the delete multiple files button:
http://www.mediafire.com/file/6c95gi8...

fore more detailed information visit:
http://csharphelper.com/blog/2017/12/...

--------------------------(optional codes you can add)--------------------------
the code for deleting a single file:
string filepath = textBox1.Text;

if (File.Exists(filepath))
{

File.Delete(filepath);
textBox1.Text = "";
MessageBox.Show("File Deleted");

}
else
{

MessageBox.Show("File Not Deleted");

}


the code for deleting a single folder:
string folderepath = folderPath1.Text;

if (Directory.Exists(folderepath))
{

Directory.Delete(folderepath, true);
MessageBox.Show("Folder Deleted");

}
else
{
MessageBox.Show("Folder Not Deleted");
}