Skip to content

Instantly share code, notes, and snippets.

@dbischof
Created November 9, 2015 02:11
Show Gist options
  • Save dbischof/4832e0a4d0e5e1d73d01 to your computer and use it in GitHub Desktop.
Save dbischof/4832e0a4d0e5e1d73d01 to your computer and use it in GitHub Desktop.
Script to fix Picasa iOS9 date import bug
#!/bin/bash
echo Finding all pictures in the wrong folder
CURDIR=$(pwd)
cd /PATH/TO/PICTURES
for FOLDER in $(find . -type d -mtime -2 -name "*-*"); do
cd $FOLDER
echo Checking $FOLDER
for PICTURE in $(find . -type f -iname "*.jpg"); do
#Also works for *.mov
FOLDERDATE=$(echo $FOLDER | awk -F '/' '{print $NF}')
CREATEDATE=$(exiftool -CreateDate $PICTURE | awk -F ' ' '{print $4}' | awk -F ':' '{print $1"-"$2"-"$3}')
if [ $FOLDERDATE != $CREATEDATE ]; then
echo Picture $PICTURE is in the wrong date folder: expected $CREATEDATE, actual $FOLDERDATE
#Create correct folder if it does not exist
#mkdir -p ../$CREATEDATE #uncomment
#Move picture to correct folder
#mv $PICTURE ../$CREATEDATE/ #uncomment
fi
done
cd ..
done
cd $CURDIR
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment