jmathai / elodie

An EXIF-based photo assistant, organizer and workflow automation tool.
https://bit.ly/introducing-elodie
Apache License 2.0
1.27k stars 139 forks source link

update EXIF by title #407

Closed edwardfxiao closed 3 years ago

edwardfxiao commented 3 years ago

It's not really an issue, just wrote a little script to achieve updating time of EXIF by its title for all items in one directory.

myscript.sh

#!/bin/bash

helpFunction()
{
   echo ""
   echo "Usage: $0 -d myDir"
   exit 1 # Exit script after printing help
}

while getopts "d:" opt
do
   case "$opt" in
      d ) myDir="$OPTARG" ;;
      ? ) helpFunction ;; # Print helpFunction in case parameter is non-existent
   esac
done

# Print helpFunction in case parameters are empty
if [ -z "$myDir" ]
then
   echo "Some or all of the parameters are empty";
   helpFunction
fi

# Begin script in case all parameters are correct
echo "$myDir"
for entry in `ls "$myDir"`
do
  filename=$(basename -- "$entry")
  extension="${filename##*.}"
  filename="${filename%.*}"
  ./elodie.py update --time $filename $myDir/$entry
done

run

sh ./myscript.sh -d "directory_path"

directory looks like this:

directory_path/2010-01-01.jpg directory_path/2010-02-02.jpg directory_path/2010-03-03.jpg