How can I change the timestamps of directories? (os.utime(), WinXP)
I'm working on a backup scheme that looks at modification times. To
run some tests I'd like to be able to set the modification time of
directories (WinXPsp2, Python-2.3.4)
os.utime() works well with files but throws a permission error with
directories. See code below.
Q: Can this be done via the os-module?
Q: Is it possible at all? Somebody knows?
mb - Martin Bless
Trying to the timestamps of a directory
import sys, os, stat, datetime, time
today = datetime.datetime.now()
pastday = today - datetime.timedelta(days=11)
atime = int(time.mktime(pastday.timetuple()))
mtime = atime
times = (atime,mtime)
path = os.path.normpath(r'c:/dummydir')
""" throws error:
OSError: [Errno 13] Permission denied: 'c:\\dummydir'
Re: How can I change the timestamps of directories? (os.utime(), WinXP)
Are you able change this directories attributes in a command shell or with
explorer? If so, have you tried win32file.SetFileAttributes()?
|All times are GMT. The time now is 04:13 AM.|
Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.