Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- function readdates {
- output=$( exiftool "-TAG" "-createdate" "-modifydate" "-metadatadate" "-datetime" "-datetimeoriginal" "-dateutc" "-modificationdate" "-datecreated" "-datetimecreated" "$i" )
- }
- echo "$# arguments"
- if [ "$#" -lt 1 ]
- then
- echo "Not enough arguments."
- exit 1
- fi
- arguments=( "$@" )
- for i in "${arguments[@]}"
- do
- echo "$i"
- readdates
- echo "Current EXIF date info: "
- echo -e "$output"
- if [ -z "$output" ]
- then
- # output is empty - success - leave the loop:
- echo "The pictures currently do not have any dates."
- # Desem la data
- echo "Saving date..."
- exiftool "-alldates<"filename "-overwrite_original" "$i"
- echo "...done."
- readdates
- echo "New EXIF date info: "
- echo -e "$output"
- else
- # output is non-empty - continue:
- echo "The picture already has date information."
- read -p "Do you want to remove it and set it again? [y/n] " -n 1 -r
- echo
- if [[ $REPLY =~ ^[Yy]$ ]]
- then
- echo "Ok. Let's update the date..."
- exiftool "-alldates=" "-overwrite_original" "$i" # remove dates
- exiftool "-alldates<"filename "-overwrite_original" "$i"
- echo "...done."
- readdates
- echo "New EXIF date info: "
- echo -e "$output"
- else
- echo "Ok. Nothing was changed."
- fi
- fi
- echo ""
- done
- sleep 5
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement