Skip to content

Instantly share code, notes, and snippets.

@mec
Created June 9, 2015 19:36
Show Gist options
  • Save mec/12256f620153935b2b8b to your computer and use it in GitHub Desktop.
Save mec/12256f620153935b2b8b to your computer and use it in GitHub Desktop.
Bash script to loop over a directory and fix the exif data to the date from the file name.
#!/bin/bash
path=$1
for file in $1/*; do
echo $file
filename=$(basename "$file" .mov)
filename=${filename//-/:}
filename=${filename//;/:}
echo "$filename"
exiftool -overwrite_original -FileModifyDate="$filename" -CreateDate="$filename" -ModifyDate="$filename" -TrackCreateDate="$filename" -TrackModifyDate="$filename" -MediaCreateDate="$filename" -MediaModifyDate="$filename" -CreationDate="$filename" "$file"
done
echo "Done."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment