为什么 os.path.exists("C:\\windows\\system32\\inetsrv\\metaback") 即使存在也会返回 False ? [英] Why would os.path.exists("C:\\windows\\system32\\inetsrv\\metaback") return False even when it exists?

查看:38
本文介绍了为什么 os.path.exists("C:\\windows\\system32\\inetsrv\\metaback") 即使存在也会返回 False ?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 python 程序,它应该清理一些目录,其中一个是 C:\windows\system32\inetsrv\metaback;但是, os.path.exists() 在该目录上返回 False 即使它存在(并且我有访问它的权限).

I've got a python program which is supposed to clean up a number of directories and one of them is C:\windows\system32\inetsrv\metaback; however, os.path.exists() returns False on that directory even though it exists (and I have permissions to access it).

有趣的是,工具 windirstat 也完全忽略了它.

What's interesting also is that the tool windirstat completely misses it as well.

谁能想出这可能的原因,以及我可以检查它是否存在的另一种方法?我什至无法在其上运行 os.listdir().

Can anyone think of a reason why this might be and what's another way I could check to see if it exist? I can't even seem to run os.listdir() on it.

更新:os.path.exists() 如果 Windows 是 32 位,则在此目录上工作,但如果是 64 位,则不工作.在 32 位机器上的 windirstat 中也能正确显示.

Update: os.path.exists() works on this directory if the Windows box is 32-bit, but not if it is 64-bit. Also shows up properly in windirstat on a 32-bit box.

推荐答案

这是工作中系统文件夹的重定向.当 32 位进程在 64 位版本的 Windows 上运行并使用路径%WINDIR%\System32,Windows替换%WINDIR%\SysWow64.

This is redirection of system folders at work. When a 32-bit process is running on a 64-bit version of Windows and uses the path %WINDIR%\System32, Windows substitutes %WINDIR%\SysWow64.

该函数返回 false 以告诉您 C:\windows\syswow64\inetsrv\metaback 不存在,而且很可能是完全正确的.

The function is returning false to tell you that C:\windows\syswow64\inetsrv\metaback does not exist, and it most likely is absolutely correct.

尝试:

os.path.exists("C:\\windows\\sysnative\\inetsrv\\metaback")

这篇关于为什么 os.path.exists("C:\\windows\\system32\\inetsrv\\metaback") 即使存在也会返回 False ?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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