在Windows 7中获取文件夹和文件访问 [英] Get Folder and File Access in Windows 7

查看:96
本文介绍了在Windows 7中获取文件夹和文件访问的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,
我正在拔头发,花很多时间在Google上.我正在编写自己的备份程序,并希望可以通过我的计算机进行访问.尝试读取我的文档"中的所有文件名时.我收到无法访问我的音乐的错误代码.这当然是背面的痛苦.我该如何解决.

Hi all,
I have being pulling my hair out and spending way to much time on google. I am writing my own backup programme and would like to have access over my machine. While trying to read all the file names in My Documents. I get the error code that I can not access My Music. Which is of course a pain in the back side. How do I get around this.

{Program is set to require admin rights at execution}


dim Folder as string 
folder=Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)
dim sPattern as string
sPatter="*.*"
for each File_Entry as string in Direcotry.GetFiles(Folder,sPattern,IO.SearchOption.AllDirectories)
'Code here to do stuff with files.
next



我收到此错误



I get this error

<br />
Access to the path ''C:\Users\{current user}\Documents\My Music\'' is denied.<br />



我尝试了以下方法.

出现错误时,继续下一步. this of course stops it in its tracks

尝试捕获结束尝试. again stops in its tracks

设置访问规则. Unless I am doing it wrong, Does not work

继续尝试Again bad idea

任何帮助都太棒了.我不想复制或最小化文件.我只想从中获取文件名和目录结构的完整列表.

干杯



I have tried the following.

On Error Resume Next. this of course stops it in its tracks

Try Catch End Try. again stops in its tracks

Setting Access Rules. Unless I am doing it wrong, Does not work

Continue For in Try Again bad idea

Any Help would be fantastic. I don''t want to copy or minipulate the files. I just want to get a complet list of filename and directory structures out of it.

Cheers

推荐答案

除非您自己以管理员权限运行,否则您将无法访问其他用户的Documents文件夹. 所以AFAIK,我认为您的问题没有解决方法.
You will not be able to access the Documents folder of another user unless you yourself are running with administrator privileges.
So AFAIK, I don''t think there is any workaround to your problem.


也许这将有助于您节省头发:
May be this will help you to save hairs: FileScan Application.


这篇关于在Windows 7中获取文件夹和文件访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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