C# 删除整个文件夹

public static void ForceClearDir(string dirPath)
{
    DirectoryInfo dirInfo = new DirectoryInfo(dirPath);
    dirInfo.Delete(true);
}

注:path是你要删除的非空目录;
true:你要删除里面所有的文件,包括文件夹和子文件夹




参考:

posted @ 2022-11-24 09:57  double64  阅读(252)  评论(0)    收藏  举报