TheLastGimbus / GooglePhotosTakeoutHelper

Script that organizes the Google Takeout archive into one big chronological folder
https://aur.archlinux.org/packages/gpth-bin
Apache License 2.0
3.47k stars 176 forks source link

Date Created v/s Date Modified #313

Closed Nikita-Saraph closed 1 month ago

Nikita-Saraph commented 1 month ago

Hello, I am not sure if I am doing this right but I was looking to get my date created updated. If you see the images attached, the date added is now under date modified Images attached for reference

Screenshot 2024-05-23 at 9 45 06 PM Screenshot 2024-05-23 at 9 41 18 PM

Is this how it's supposed to be? Or Am I doing something wrong? Thank you!

(I learnt how to use Terminal for the first time 3 days back. So I request you to help me explain it like a 5 year old, it's all too new for me but I am here to learn

palijn commented 1 month ago

Hello, I think gpth is indeed supposed to set the modified date attribute of the file, only. Here is a quick script I jot down for you that you can use to post-process the files. It will take the modification date of the file and set its creation date to it. You may need to install the XCode Developer Tools first (look it up).

At this stage this script is not recursive, so, you'll have to run it for each folder you need to. Save these lines in a file named set-cdate-from-mdate.sh, execute chmod +x set-cdate-from-mdate.sh and run , for example, as "./set-cdate-from-mdate.sh /path/to/the/photos/folder/*.jpg" .

#!/bin/bash

for file in "$@"
do
        echo "Set $file"
        cdateori=$(GetFileInfo -d $file)
        echo "Creation date before: $cdateori"
        mdate=$(GetFileInfo -m $file)
        SetFile -d "$mdate" $file
        cdatenow=$(GetFileInfo -d $file)
        echo "Creation date now: $cdatenow"
done
TheLastGimbus commented 1 month ago

Yeah you're good. Gpth can't edit fileCreation because Dart (programming language it uses) can't. It's a bit of shame but you're all good, just set your file explorer to sort by file modified 👍

Nikita-Saraph commented 1 month ago

Yeah you're good. Gpth can't edit fileCreation because Dart (programming language it uses) can't. It's a bit of shame but you're all good, just set your file explorer to sort by file modified 👍

Got it thank you! This tool / code / path (I don't know, apologies) is outstanding! Thanks!

Nikita-Saraph commented 1 month ago

Hello, I think gpth is indeed supposed to set the modified date attribute of the file, only. Here is a quick script I jot down for you that you can use to post-process the files. It will take the modification date of the file and set its creation date to it. You may need to install the XCode Developer Tools first (look it up).

At this stage this script is not recursive, so, you'll have to run it for each folder you need to. Save these lines in a file named set-cdate-from-mdate.sh, execute chmod +x set-cdate-from-mdate.sh and run , for example, as "./set-cdate-from-mdate.sh /path/to/the/photos/folder/*.jpg" .

#!/bin/bash

for file in "$@"
do
        echo "Set $file"
        cdateori=$(GetFileInfo -d $file)
        echo "Creation date before: $cdateori"
        mdate=$(GetFileInfo -m $file)
        SetFile -d "$mdate" $file
        cdatenow=$(GetFileInfo -d $file)
        echo "Creation date now: $cdatenow"
done

Hey thank you! I will try this! This is super helpful!