Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Digikam export modifies file to current date?!
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
Budoka
l33t
l33t


Joined: 03 Jun 2012
Posts: 777
Location: Tokyo, Japan

PostPosted: Wed Nov 14, 2018 2:45 pm    Post subject: Digikam export modifies file to current date?! Reply with quote

I wasn't sure where to ask this so am starting in the "other" forum.

Long story short...I found out the hard way that Digikam export to Google Photos apparently changes the modify time to current...eventhough there isn't any "modification" of the actual file going on...before exporting to Google Photos. So any photo exported will have the date of export, not file creation.

I have seen that there was trouble with Google Photos in the past not preserving creation dates but that doesn't appear to be the case here. I tested uploading numerous files directly in the web interface and it keeps the creation date. Then when I export the same files via digikam they are changed...and on my local drive as well. I am not sure if this is a bug or a feature but it is annoying given I exported a couple of thousand images. I will try to post this on an appropriate DIgikam forum but until then...

I can see that the original create date is still preserved somewhere in the file because digikam shows it in the file properties in addition to the modified date. When I stat the actual file as well I can see an access date that appears to be that but I am not sure yet.

Is there a way for me to batch change all of the modified dates in these files back to the create date? Both sets of information are clearly there.
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 21595

PostPosted: Thu Nov 15, 2018 1:59 am    Post subject: Reply with quote

This seems like a programming question to me. :) You need a way to visit each file, dump out its internally recorded time, and then change the filesystem mtime to match that. The quick and crude way would be a shell script. The obvious implementation is not efficient, but it is easy to write.
Code:
#!/bin/bash

for f; do
   touch -d "$(/usr/bin/identify -verbose -format '%[EXIF:DateTime]' "$f" | sed -e 's/:\([^:]*\):/-\1-/')" "$f"
done
This assumes that you have an EXIF DateTime recorded in the file. If that is not how the date is being tracked, the above will not work. We would need to see how the data is tracked. If you are not sure, provide the output of identify -verbose filename.
Back to top
View user's profile Send private message
Budoka
l33t
l33t


Joined: 03 Jun 2012
Posts: 777
Location: Tokyo, Japan

PostPosted: Fri Nov 16, 2018 1:55 am    Post subject: Reply with quote

Hu wrote:
This seems like a programming question to me. :) You need a way to visit each file, dump out its internally recorded time, and then change the filesystem mtime to match that. The quick and crude way would be a shell script. The obvious implementation is not efficient, but it is easy to write.
Code:
#!/bin/bash

for f; do
   touch -d "$(/usr/bin/identify -verbose -format '%[EXIF:DateTime]' "$f" | sed -e 's/:\([^:]*\):/-\1-/')" "$f"
done
This assumes that you have an EXIF DateTime recorded in the file. If that is not how the date is being tracked, the above will not work. We would need to see how the data is tracked. If you are not sure, provide the output of identify -verbose filename.


Thank you Hu. As is often the case I am a little out of my depth here so appreciate the help.

Here is an example of one of the files that were modified. https://paste.pound-python.org/show/VNdSnSMVx7yIyMvZcWuL/

I see that in the exif data it is showing both the create and modify date as the same. I assume that is bad?
Code:
  Properties:
    date:create: 2018-11-11T12:35:54+09:00
    date:modify: 2018-11-10T21:22:45+09:00


However when I look at the file in the app it shows the "Creation Date" as 11/08/15 8:09PM. Clearly this info is being stored somewhere but I am at a loss where.
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 21595

PostPosted: Fri Nov 16, 2018 2:34 am    Post subject: Reply with quote

date:create and date:modify are derived from the filesystem's metadata for the file, not from any intrinsic content. You can observe this by copying the file to a new name (thus changing the mtime), then running identify on the copy.

The output you provided does not show anything that I can see how to convert into the timestamp you say is presented to you. I don't know where the information is stored if it isn't in a metadata block shown by Imagemagick. If you can find a way to extract that information, we can help you script applying that through a variant of the script I showed above. It might be helpful if you could upload a sample image somewhere for someone to inspect. However, even if the image is not sensitive/personal, be aware that it may contain metadata that is sensitive (such as device serial numbers, GPS coordinates, etc.) that could be used to identify you. If this is a concern for you, and you cannot verify that the file is free of such information, then do not upload the file.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum