在我写的应用,用户必须增加一些文件夹来搜索某些文件递归的能力。
In the application I am writing, the user has the ability to add some folder to search for some files recursively.
的问题是他想要添加到应用程序中的文件可能存储在像K代表基线驱动:.所以,如果他直接添加该驱动器,我得到一个例外。
The problem is the files he wants to add to the app might be stored in the base drive like K:. So if he add this drive directly, I get an exception.
或者,如果他补充说C:,然后我得到UnauthorizedAccessException那里说:
Or if he adds C:, then I get UnauthorizedAccessException where it says:
访问路径C:系统卷信息。被拒绝
Access to the path 'C:System Volume Information' is denied.
我怎么能只扫描在那里我可以扫描?而给扫描其他非系统驱动器全面的能力(所有目录)?
How can I just scan where I can scan? And give the ability to scan another non-system drive fully (all directories)?
推荐答案
捕获异常,忽略它,并移动到下一个目录。
Catch the exception, ignore it, and move on to the next directory.
相关推荐
最新文章