Add ten seconds to creation time in windows
<p>I am trying to write a script that changes the creation time of a file by increasing it by 10 seconds. I am testing it on Windows 7, but would also like to run it in XP. I tried to follow the solution from <a href="http://stackoverflow.com/questions/4996405/how-do-i-change-the-file-creation-date-of-a-windows-file-from-python">How do I change the file creation date of a Windows file from Python?</a> with the following code:</p>

<pre><code>import os
import pywintypes, win32file, win32con
def changeFileCreationTime(fname, newtime):
    wintime = pywintypes.Time(newtime)
    winfile = win32file.CreateFile(
        fname, win32con.GENERIC_WRITE,
        win32con.FILE_SHARE_READ | win32con.FILE_SHARE_WRITE | win32con.FILE_SHARE_DELETE,
        None, win32con.OPEN_EXISTING,
        win32con.FILE_ATTRIBUTE_NORMAL, None)

    win32file.SetFileTime(winfile, wintime, None, None)

    winfile.close()


for (path, dirs, files) in os.walk('C:/Personal/fc/Images/Corvette'):
    for file in files:
        print(os.path.join(path, file))
        print(os.stat(os.path.join(path, file)))
        changeFileCreationTime(os.path.join(path, file),os.stat(os.path.join(path, file)).st_ctime+10)
        print(os.stat(os.path.join(path, file)))
</code></pre>

<p>but I get the error:</p>

<pre><code>Traceback (most recent call last):
  File "C:\Python31\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py", line 326, in RunScript
   exec(codeObject, __main__.__dict__)
  File "C:\Users\hermamr1\Desktop\Script1.py", line 20, in &lt;module&gt;
   changeFileCreationTime(os.path.join(path, file),os.stat(os.path.join(path, file)).st_ctime+10)
  File "C:\Users\hermamr1\Desktop\Script1.py", line 11, in changeFileCreationTime
   win32file.SetFileTime(winfile, wintime, None, None)
ValueError: astimezone() cannot be applied to a naive datetime
</code></pre>

<p>I am trying this on Python 3.1.3 but I can use Python 2.7 if needed.  I will only need to run this on Windows.</p>
