Last active
September 5, 2017 03:53
-
-
Save youchen/3d181aecb3b022ff3f7a6a08fdfdd70b to your computer and use it in GitHub Desktop.
Script to shift the timestamp of file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# source: https://morimori.tokyo/2015/10/adjusting-timestamps-from-a-gopro/ | |
# | |
#!/usr/bin/env bash | |
FILES=$(ls *.MP4) # FILES=$(ls *.{JPG,MP4}) | |
for filename in $FILES | |
do | |
# Offset is 974 days 10 hours 39 minutes | |
NEWDATE=$(date -j -v+974d -v+10H -v+39M -f "%m/%d/%Y %H:%M:%S" "$(GetFileInfo -m $filename)" +"%m/%d/%Y %H:%M:%S") | |
echo $filename - $NEWDATE | |
# Adjust modification time: | |
SetFile -m "$NEWDATE" "$filename" | |
# Adjust creation date | |
SetFile -d "$NEWDATE" "$filename" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment