C# 取消文件隐藏并恢复标准文件

C# 取消文件隐藏并恢复标准文件

DirectoryInfo di = new DirectoryInfo(@"D:\Software");
foreach (DirectoryInfo sub in di.GetDirectories())
{
    File.SetAttributes(sub.FullName, FileAttributes.Normal);
}
foreach (FileInfo fi in di.GetFiles("*.*",SearchOption.AllDirectories))
{
    File.SetAttributes(fi.FullName, (~FileAttributes.ReadOnly) & (~FileAttributes.Hidden));
    File.SetAttributes(fi.FullName, FileAttributes.Normal);
}
posted @ 2021-12-15 14:24  devs  阅读(203)  评论(0编辑  收藏  举报