Last active
February 13, 2022 20:53
-
-
Save seanburlington/4f4e55de65397a00b94a41e3bd8ade33 to your computer and use it in GitHub Desktop.
Google Photos Takeout Cleanup
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -euo pipefail | |
find ~/Pictures -type f -printf "%f\n" | sort | uniq > ~/picture-names | |
cd /media/sean/Backup/burlington.me.uk-takeout | |
number=02 | |
mkdir -p ~/Pictures/google-takeout/${number} | |
unzip takeout-20220208T164343Z-0${number}.zip | |
cd Takeout/Google\ Photos/ | |
find . -name '*.json' -exec rm -v {} \; | |
# get rid of auto edited versions | |
find . -name '*-edited.*' -exec rm -v {} \; | |
find . -type f -printf "%f\n" | grep -vf ~/picture-names > missing-images.txt | |
while read in ; do find . -name "$in" >> missing-images-with-paths.txt; done < missing-images.txt | |
cat missing-images-with-paths.txt | while read in; do cp -v "$in" ~/Pictures/google-takeout/${number}; done | |
fdupes -r ~/Pictures/google-takeout/${number} --delete --noprompt | |
cd /media/sean/Backup/burlington.me.uk-takeout | |
rm -Rf Takeout/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is specific to my file structure
It will need editing
it's not perfect - but worked OK