[melbourne-pug] Changing file CREATION date with python 2.7(.3)under Windows 7
Mark Hammond
skippy.hammond at gmail.com
Wed Jun 6 04:54:42 CEST 2012
On 6/06/2012 12:22 PM, David Crisp wrote:
> Is there any way of changing the file creation date using python 2.7.3
> under windows 7?
With pywin32 installed you can do it using something like the following
script, which sets the create time to "now" (and leaving the file with a
create time *after* the modified time, which seems strange but works)
import sys
import win32file
import win32con
import datetime
handle = win32file.CreateFile(sys.argv[1],
win32con.GENERIC_WRITE,
0, None, win32con.OPEN_EXISTING, 0, None)
now = datetime.datetime.now()
win32file.SetFileTime(handle, now, None, None)
handle.close()
HTH,
Mark
>
> The problem is; I have 3000 photos taken on a digital camera during my
> recent holiday. The digital camera time clock was off by 45 minutes. I
> have photos(7000) taken on a second digital camera which had its time
> set correctly!. I want to be able to merge the photos and have them all
> sorted in the right sequence.
>
> I have used python already to modify the EXIF data of these images to
> have the correct date taken data. I would like the file creation date
> to reflect this. (if only to prevent future confusion about which photos
> were taken when)
>
> Regards,
> David Crisp
> _______________________________________________
> melbourne-pug mailing list
> melbourne-pug at python.org
> http://mail.python.org/mailman/listinfo/melbourne-pug
More information about the melbourne-pug
mailing list