Importiere ich Fotos in Lightroom, lasse ich sie mittels des Aufnahmedatums in eine Ordnerstruktur ablegen: Jahr/Monat/Tag. Die Vorteile sind klar: Saubere chronologische Sortierung und damit auch eine gewisse Unabhängigkeitvon der Bildverwaltungssoftware. Leider kann Lightroom ab Werk bei einem Export Bilder nicht in diese oder ähnliche Ordnerstrukturen ablegen sondern ausschließlich in nur einen Ordner. Ist natürlich doof. Deshalb hier ein Shell-Skript, welches Bilder im aktuellen Ordner nach ihrem Aufnahmedatum in Ordner einsortiert. Achtung, quick and dirty! Wichtig ist nur, dass es funktioniert.
# sort.sh #!/bin/bash find . -print0 -maxdepth 1 | while read -d $'\0' file do if [[ $file == *.jpg ]]; then echo "==========" echo "$file" export year=`mdls "$file" | grep ContentCreationDate | awk '{print $3}' | cut -d "-" -f 1` export month=`mdls "$file" | grep ContentCreationDate | awk '{print $3}' | cut -d "-" -f 2` export day=`mdls "$file" | grep ContentCreationDate | awk '{print $3}' | cut -d "-" -f 3` if [ ! -d "$year" ]; then mkdir ./$year/ echo "$year created" fi if [ ! -d "$year/$month" ]; then mkdir ./$year/$month/ echo "$year/$month created" fi if [ ! -d "$year/$month/$day" ]; then mkdir ./$year/$month/$day/ echo "$year/$month/$day created" fi mv "$file" ./$year/$month/$day/ fi done
Dein Kommentar
Willst Du mitdiskutieren?Ich freue mich über deinen Kommentar!