dxangel, thanks for the reply.
You information about stats was what I was looking for.
Here is the results of the stats on one of the images that is causing problems.
#:~/pictures/2004/10$ stat 2004-10-01_163900.jpg
Size: 1193225 Blocks: 2336 IO Block: 4096 regular file
Device: 804h/2052d Inode: 133334 Links: 1
Access: (0777/-rwxrwxrwx) Uid: ( 1000/ troy) Gid: ( 1000/ troy)
Access: 2009-07-23 18:38:29.212744000 -0400
Modify: 2004-10-01 17:39:00.000000000 -0400
Change: 2009-07-23 18:38:29.240747160 -0400
As you can see the Modify date is older then the other two. I am not sure which date digikam is using since the exif and iptc information is missing for the images. What I would like to do is reset all the date values to match the modified date.
I coded up some python that searches a folder for images that have an access date that is newer then the modified, but I don't know how to reset all of the time values to match?
#! /usr/bin/env python
import os, fnmatch, sys, time, stat
def locate(pattern, root=os.curdir):
for path, dirs, files in os.walk(os.path.abspath(root)):
for filename in fnmatch.filter(files, pattern):
yield os.path.join(path, filename)
if __name__ == '__main__':
path = '/home/troy/pictures/2004/10/'
pattern = '*.jpg'
for item in locate(pattern, path):
stats = os.stat(item)
if time.localtime(stats[stat.ST_MTIME]) < time.localtime(stats[stat.ST_CTIME]):
print "file = ", os.path.basename(item), " creation time newer than last modified"