SortTime

SortTime is an (obsolete) shell script taken from the internet (or adapted, we don't remember) that we were using to order our pictures in directory trees named after the time the picture had been taken. It provided faithful services but its agonizing time of execution forced us to upgrade it with Sopi.

#!/bin/sh

# Goes through all jpeg files in current directory, grabs date from each
# and sorts them into subdirectories according to the date
# Creates subdirectories corresponding to the dates as necessary.

for fil in *.JPG
do
    datepath="$(identify -verbose $fil | grep DateTimeOri | awk '{print $2 }' | sed s%:%/%g)"
    if ! test -e "$datepath"; then
        mkdir -pv "$datepath"
    fi

    mv -v $fil $datepath
done