Created
April 8, 2015 05:42
-
-
Save jobwat/dc6479f20e0f74e10e0d to your computer and use it in GitHub Desktop.
Shift the datetime of files according to the sample gap
This file contains 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
ref_file=GOPR3440.MP4 | |
new_time_for_that_file=0327160015 #date's format: 27th March 2015, 16:00 | |
ref_file_timestamp=`stat -f %B -t %s "$ref_file"` | |
new_time_timestamp=`date -j $new_time_for_that_file +%s` | |
time_diff=$[$new_time_timestamp - $ref_file_timestamp] | |
for f in *; do | |
old=$(stat -f %B -t %s "$f") | |
new=$(date -r $(($old + $time_diff)) '+%m/%d/%Y %H:%M:%S') | |
SetFile -d "$new" -m "$new" "$f" | |
done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment