Re: Is it possible to set the date/time of a directory in windows with Python? If so how?



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,
win32con.FILE_FLAG_BACKUP_SEMANTICS, None)
nowWin32=pywintypes.Time(theTime)
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.

thanks again

.



Relevant Pages

  • Re: Regular Expressions - Python vs Perl
    ... > I am interested in regular expressions and how Perl and Python ... > complex regex operations...basically is RegEx a strong module/library ... 'completeness' may be a more ...
    (comp.lang.python)
  • Re: if statements with or w/o else statements
    ... Bart Nessux wrote: ... For completeness, it seems the two ... be to look into the python library. ... """ Analyse if statements in python scripts ...
    (comp.lang.python)
  • Re: unicode() vs. s.decode()
    ... "decode" was added in Python 2.2 for the sake of symmetry to encode. ...
    (comp.lang.python)
  • Re: Powers of 5
    ... by successive squaring. ... in Python for the sake of being concise, but now the function takes k ...
    (sci.math)
  • Regular Expressions - Python vs Perl
    ... I am interested in regular expressions and how Perl and Python ... memory usage, flexibility, completeness (i.e. supports simple and ... complex regex operations...basically is RegEx a strong module/library ...
    (comp.lang.python)