拒绝访问目录/文件夹
我只是浪费了一个小时左右来追这个。我能够解决它,但将其以问答形式希望其他人可能受益。
症状是我无法访问目录。我可以在资源管理器或命令窗口中浏览到它。我什至在属性窗口中看不到它的安全权限。
该文件夹是由我们的构建过程创建的,这意味着我几乎无法做任何工作。在网上搜索没有帮助。
回答如下。
I just wasted an hour or so chasing this. I was able to resolve it but putting it in q/a form hoping others might benefit.
The symptom was that I could not access a directory. I could browse to it in explorer or command window. I could not even see its security permissions in properties window.
The folder is created by our build process, which meant I could pretty much do no work. Searching on net was no help.
Answer below.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
事实证明,这与 cygwin 不锁定目录有关。构建过程删除了目录 (
rmdir /su:\target
),然后重新创建它 (mkdir u:\target
)。我有一个 bash 窗口,其中该目录是当前目录。当构建过程(bat 文件)调用
rmdir
时,它成功,甚至%errorlevel%
为 0。但是后续的mkdir code> 失败,
访问被拒绝。
。不幸的是,构建过程仅检查rmdir
失败,而不检查mkdir
。感谢
handle.exe
,我发现该文件夹正在被bash.exe
使用,从那里开始就很简单了。更改当前目录最终删除了该文件夹,然后再次构建,将一切设置正确。我意识到这是 unix 行为,只有在所有处理文件都关闭后才删除文件,但它在 Windows 中的模拟有点不直观。
It turns out it has to do with how
cygwin
does not lock a directory. The build process removed the directory (rmdir /s u:\target
) and then recreated it (mkdir u:\target
). I had a bash window where that directory was the current directory.When the build process (bat file) called
rmdir
it succeeded, even%errorlevel%
was 0. However the subsequentmkdir
failed withAccess is denied.
. The build process unfortunately checked only forrmdir
failure, notmkdir
.Thanks to
handle.exe
I found the folder to be in use bybash.exe
, From there it was straightforward. Changing the current directory finally deleted the folder and another go at build set everything right.I realize this is unix behavior to remove a file only after all handled to it are closed, but its simulation in windows is somewhat non-intuitive.