如何扫描名为“系统卷信息"的文件夹? [英] How to Scan folder called "System Volume Information"?

查看:83
本文介绍了如何扫描名为“系统卷信息"的文件夹?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

朋友,

我正在开发一个名为计算机扫描仪"的项目,到目前为止,我已经完成了编码工作,可以扫描特定的文件夹和文件.最终,我已经完成了对硬盘驱动器(C:\\,D:\\)的编码.还是现在,当我调试项目以扫描计算机硬盘时,它给了我一个错误
拒绝访问路径"D:\ System Volume Information \"."
因此,我想摆脱此异常,在研究了来自互联网的此错误之后,我知道当我们在计算机硬盘驱动器中创建分区时这些文件夹系统卷信息"会创建,因此它包含一些Windows信息,所以我不会能够删除它.而且我尝试为我的代码赋予管理员权限"以便运行,但仍向我显示相同的异常.
所以请帮助我也扫描这些文件夹,

这是代码.


在此先感谢:)

如果(folderBrowserDialog1.SelectedPath =="D:\\")
{
//为程序提供管理身份验证
WindowsIdentity currentIdentity = WindowsIdentity.GetCurrent();
WindowsPrincipal currentPrincipal =新的WindowsPrincipal(currentIdentity);

如果(currentPrincipal.IsInRole(WindowsBuiltInRole.Administrator))
{
//获取选定路径中的所有文件夹

List< string> dirListoffoldersinD = Directory.GetDirectories(@ folderBrowserDialog1.SelectedPath,"*.*",SearchOption.AllDirectories).ToList();
progressbar1.Maximum = dirListoffoldersinD.Count();

Hi Friends,

I am working on a Project Called "Computer Scanner", till now i am done with coding in order to scan a Particular Folders and Files.Eventually, i have coded to scan my Hard Drive (C:\\, D:\\) as well so now, When i debug my project in order to scan my computers Hard Drives its giving me an error
"Access to the path ''D:\System Volume Information\'' is denied."
So i wants to get rid of this Exception, After studing about this error from internet i got to know that these folders "System volume Information" creates when we create partition in our computers hard drives so it contain some Windows information so i would not be able to delete it. And i tried giving Admin Rights to my code in order to run, but still showing me the same exception.
So plz help me to scan these folders as well,,

Here is the Code.


Thanks in Advance :)

if (folderBrowserDialog1.SelectedPath == "D:\\")
{
//Giving Administration Authentication to the Program
WindowsIdentity currentIdentity = WindowsIdentity.GetCurrent();
WindowsPrincipal currentPrincipal = new WindowsPrincipal(currentIdentity);

if (currentPrincipal.IsInRole(WindowsBuiltInRole.Administrator))
{
//Get all the Folders in Selected Path

List<string> dirListoffoldersinD = Directory.GetDirectories(@folderBrowserDialog1.SelectedPath, "*.*", SearchOption.AllDirectories).ToList();
progressbar1.Maximum = dirListoffoldersinD.Count();

推荐答案

这不是可以消除的错误".系统文件受访问控制的保护,因此您需要更改对象的访问权限.尝试在Google上搜索有关此操作的建议.
This is not an "error" that you can get rid of. System files are protected by access control so you need to change the permissions of the object to access it. Try searching Google for suggestions on how to do this.


这篇关于如何扫描名为“系统卷信息"的文件夹?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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