How to delete folder with files on c#
Directory.Delete(@"folderPath", true);
How to delete folder with files on c#
Directory.Delete(@"folderPath", true);
c# delete files in directory and subdirectories
public static void RecursiveDelete(DirectoryInfo parentDir)
{
if (parentDir.Exists)
{
foreach (var dir in parentDir.EnumerateDirectories())
{
RecursiveDelete(dir);
}
var files = parentDir.GetFiles();
foreach (var item in files)
{
item.IsReadOnly = false;
item.Delete();
}
parentDir.Delete(true);
}
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us