Is it possible to set the date/time of a directory in windows with Python? If so how?
ToddLMorgan at gmail.com
Sat May 13 14:46:43 CEST 2006
Thanks very much for that roger :-)
I changed my code to
filehandle = win32file.CreateFile(file, win32file.GENERIC_WRITE,
win32file.FILE_SHARE_WRITE, None, win32con.OPEN_ALWAYS,
win32file.SetFileTime(filehandle, nowWin32, nowWin32, nowWin32)
ie FILE_FLAG_BACKUP_SEMANTICS and everything works fine
Just for the sake of completeness ...
I'd just thought of another solution ... to have python determine the
modification date for the directory based upon the oldest contained
file (I'm guessing windows does the opposite - ie the newest file mod)
to give me the effect of having a directory with an older date.
The virtual file system idea didn't work either ... files had the
correct dates but the dirs didn't as doing the extraction with python
libs is subject to the same constraints ... and I didn't think that
altering the ZipInfo time entries would have any affect as they appear
to only represent files and not directories. I could have spawned a
command line to do the extraction but I lost interest at that point.
More information about the Python-list