Skip to content

Instantly share code, notes, and snippets.

@pas-calc
Created May 3, 2021 17:24
Show Gist options
  • Save pas-calc/e23827f653fd6e52a62a68fc9a73b990 to your computer and use it in GitHub Desktop.
Save pas-calc/e23827f653fd6e52a62a68fc9a73b990 to your computer and use it in GitHub Desktop.
Import Photos from external device (camera, mobile phone). Create directory structure based on year-month
#!/bin/bash
# Import von X2-02
# 17APR2015, bilder->images 22FEB2017, delete empty dirs 14APR2020
echo "Importing Photos..."
folder="/media/pascal/microSD 2GB/Images" # Bilder
echo "change to dir: \"${folder}\""
cd "$folder" 2>/dev/null
res=$?
if [ "$res" == "0" ] ; then
echo "directory ok" #pwd
exiftool "-Directory<DateTimeOriginal" -d "/home/pascal/Bilder/Fotos/Handy Nokia X2-02/%Y-%m" .
else
echo "failed"
fi
echo "Delete empty dirs"
find . -maxdepth 1 -type d -empty -delete -print
echo ""
read -t 5 -p "$(tput setaf 7)Press [Enter] key (or wait 5 secs) ...$(tput sgr0)"
exit $res
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment