DIR reports file timestamp and size, but os.path.getctime(), os.path.getsize() raise WindowsError [Error 5] Access is denied
python at bdurham.com
python at bdurham.com
Mon May 21 20:01:59 EDT 2012
Wondering if any of you have stumbled across the following
behavior:
I'm doing a recursive directory listing of my Windows folder and
I can access the timestamps and file sizes of all files except
the following 6 files:
In the \windows\microsoft.net\framework\v2.0.50727\config folder:
enterprisesec.config.cch.6824.14057640
security.config.cch.6824.14057640
In the \windows\\microsoft.net\framework64\v2.0.50727\config
folder:
\enterprisesec.config.cch.4412.14151427
enterprisesec.config.cch.6912.14056844
security.config.cch.4412.14151427
security.config.cch.6912.14056844
When I attempt to do any of the following on the above files, a
WindowsError exception is raised with a value of "[Error 5]
Access is denied: ...".
os.path.getctime()
os.path.getatime()
os.path.getmtime()
os.path.getsize()
What's strange is that the DIR command from a cmd prompt returns
timestamps and file sizes for the above files.
Background; 64-bit Windows 7; 32-bit Python 2.7.2
Any ideas on how I can retrieve timestamps and file sizes like
DIR without raising exceptions?
Thank you,
Malcolm
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20120521/1551343d/attachment.html>
More information about the Python-list
mailing list