如何排除在搜索受保护的操作系统文件 [英] How to Exclude protected Operating system files in search

查看:238
本文介绍了如何排除在搜索受保护的操作系统文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

(使用Windows 7 64位和C#)



有没有办法从你的搜索中排除这些受保护的文件吗?



这是显示该文件夹中的所有文件,包括系统文件

 的String []文件=目录。的GetFiles(目录); 



在这里输入的形象描述


解决方案

  VAR名单=新的DirectoryInfo(@C:\)。的GetFiles()
。其中,(F =>!f.Attributes.HasFlag(FileAttributes.System))
。选择(F => f.FullName)
.ToList();


(Using windows 7 64bit and C#)

Is there any way to exclude these protected files from your search?

This is Showing ALL the files in the folder including the "System Files"

string[] files = Directory.GetFiles(directory);

解决方案

var list = new DirectoryInfo(@"C:\").GetFiles()
                .Where(f => !f.Attributes.HasFlag(FileAttributes.System))
                .Select(f => f.FullName)
                .ToList();

这篇关于如何排除在搜索受保护的操作系统文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆