change mtime of directory under windows

matt matt at greenroom.com.au
Tue Dec 17 16:47:16 EST 2002


stojek at part-gmbh.de (Marcus Stojek) wrote in message news:<3dff2605.14109734 at news.easynews.net>...
> Hi,
> can anybody tell me please how to change mtime and/or atime for
> a directory under windows.
> 
> os.utime(dir,(mtime,atime)) doesn't work (Permission denied)
> win32file.SetFileTime(dir,mtime) doesn't work either, because dir is
> no file handle
> 
> I didn't find anything useful.
> 
> Thanks,
> marcus

On win32, directories are handled very differently to files. On a *nix
system, it's a very different story. It's possible that os.utime
doesn't support win32 directories (can anyone help me with this).

In the meantime however, you could download a copy of cygwin
(www.cygwin.com) and call the touch command through python. That way
you don't need to get any nasty involvement with the winapi.



More information about the Python-list mailing list