You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
557 B
Bash

#!/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")