检查文件是否在 C# 中隐藏
如需检索文件的属性,请使用 FileAttributes 枚举类型。它具有压缩、目录、隐藏等各种成员。
如需检查文件是否隐藏,请使用隐藏成员名称。
如果设置了 FileAttributes.hidden,将表示文件处于隐藏状态。首先,获取路径以查找属性。
FileAttributes attributes = File.GetAttributes(path);
如果设置了以下内容,将表示现在已使用隐藏成员名称隐藏了文件。
File.SetAttributes(path, File.GetAttributes(path) | FileAttributes.Hidden);
Console.WriteLine("The {0} file is hidden.", path);
广告
数据结构
网络
RDBMS
操作系统
Java
iOS
HTML
CSS
Android
Python
C 编程
C++
C#
MongoDB
MySQL
Javascript
PHP