From b2475712c27f14f1657a6ae544d53032320994ba Mon Sep 17 00:00:00 2001 From: GRayHook Date: Sat, 14 Jun 2025 10:04:03 +0700 Subject: [PATCH] init --- fix_gto.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100755 fix_gto.sh diff --git a/fix_gto.sh b/fix_gto.sh new file mode 100755 index 0000000..645e33b --- /dev/null +++ b/fix_gto.sh @@ -0,0 +1,17 @@ +#!/bin/bash +while read -r json_file; do + dirname=$(dirname "$json_file") + picture_ts=$(jq -r '.photoTakenTime.timestamp' "$json_file") + filename=$(jq -r '.title' "$json_file") + if [[ "$filename" != "null" ]]; then + filename="$dirname/$filename" + if [[ -e "$filename" ]]; then + touch_string=$(date -d "@$picture_ts" +%Y%m%d%H%M) + ls -la "$filename" + touch -m -t "$touch_string" "$filename" + ls -la "$filename" + else + >&2 echo "Cannot find $filename referenced by $json_file" + fi + fi +done < <(find ./ -name "*.json")