I tried utime() on both Windows (XP) and Linux. On Windows I get an EACCES error, on Linux I don’t get any error (but the time is not changed). My utime() code is fine, because it works on files. I could not find if utime() is supposed to work on directories or not, but if not, how can I change the time and date?
I am looking for a solution that would ideally work for both Windows and Linux, but if not, I can always use some OS specific code.
[edit]
It seems that utime does indeed work on Linux, but it didn’t appear to work for me because I was moving files in that directory, and that updated the time stamp to the current time.
For Windows you can use the SetFileTime which also works for directories.