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);
}