(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();
You can use FileInfo.
var fileInfo = new FileInfo(path);
if((fileInfo.Attributes & FileAttributes.System) != FileAttributes.System))
{
// path is not a system file
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With