如何判断一个文件是系统文件还是隐藏文件?
例如'C:\File.txt'是否是系统文件。 还有它是否隐藏?
最佳答案
您可以使用 GetAttributes方法:
var att = File.GetAttributes(@"c:\file.txt");
if ((att & FileAttributes.Hidden) == FileAttributes.Hidden)
{
// the file is hidden
}
if ((att & FileAttributes.System) == FileAttributes.System)
{
// the file is system
}
关于c# - 如何查找文件是系统文件还是隐藏文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3486560/