Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Batch shift the creation date of files on Mac OS
- # Source: https://superuser.com/a/894991/105418
- # to shift files dates with a reference file/date (the old GoPro always reset its time to 2009..)
- 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
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement