m (Created page with "= SortTime = '''''SortTime''''' is an (obsolete) shell script we were using to order our pictures in directory trees named after the time the picture had been taken. It provi...")
 
m (SortTime)
Line 10: Line 10:
 
# Creates subdirectories corresponding to the dates as necessary.
 
# Creates subdirectories corresponding to the dates as necessary.
  
for fil in *.JPG  # Also try *.JPG
+
for fil in *.JPG
 
do
 
do
 
     datepath="$(identify -verbose $fil | grep DateTimeOri | awk '{print $2 }' | sed s%:%/%g)"
 
     datepath="$(identify -verbose $fil | grep DateTimeOri | awk '{print $2 }' | sed s%:%/%g)"

Revision as of 21:32, 10 October 2020

SortTime

SortTime is an (obsolete) shell script 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