Warning: Cannot modify header information - headers already sent by (output started at /data/web/virtuals/85063/virtual/www/domains/waldauf.org/lib/plugins/color/syntax.php:1) in /data/web/virtuals/85063/virtual/www/domains/waldauf.org/inc/actions.php on line 180
photo:commandline:sort_pictures - WiKi

Sort pictures

Sorting and renaming

Exiftool

Sort pictures according DAY and TIME of taking - create DIR for every day:

exiftool -r '-FileName<CreateDate' -d '%Y-%m-%d/indie_%Y%m%d-%H%M%S%%-c.%%le'

Where:

  • -r is for recursion
  • -FileName<CreateDate tells exiftool to rename the file accordingly to its EXIF tag CreateDate (you can try others like ModifyDate though)
  • -d '%Y-%m-%d/%H_%M_%S-c.le tells how to build the filename string from the date source “CreateDate” (the ”%-c” will append a counter in case of file collisions, the ”%le” stands for “lower cased file extension”)

Note: I used ”-FileName<…” here for renaming the files and moving it to another folder within one step. The manual points out that you have to use the ”-Directory<…” syntax for folder operations. It worked for me this way though (Source).

Exiv2

This script enable sorting and reanaming:

name="indie"
c=0 
 
for ii in $(ls -1 *.ORF | grep -v ${name}); do 
  c=$(( c + 1 )) 
  if exiv2 $ii > /dev/null; then  
    #exiv2 -v -r 'indie_%Y%m%d-%H%M%S---:basename:' rename $ii 
    exiv2 -v -r 'indie_%Y%m%d-%H%M%S' rename $ii 
  else 
    echo "ERROR - $ii"
  fi
  echo "Pocet = $c"
  echo
  echo
done
Navigation
Print/export
Toolbox