Last active
July 22, 2022 16:57
-
-
Save alexanderbird/ca76877fd57281f42aef48ff49351881 to your computer and use it in GitHub Desktop.
Download a Google Photos Album in order (a rather hacky approach, but the only one I found)
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
# Developed for Firefox on Mac | |
# | |
# 1. Empty your Downloads folder | |
# 2. Create a subdirectory under Downloads called `google-photos-download` | |
# 3. Run the following script with your Downloads folder as the working directory | |
# 4. Through your browser, one photo at a time (starting with the first until the last), select it with the mouse and press Shift+D to download | |
# once your browser releases the lock on the file, the script will move it to ./google-photos-download and rename it so its name reflects its order | |
# | |
# I found it helpful to have the Downloads and google-photos-download folders open and visible in Finder windows to get feedback about | |
# what the script is doing. I also have the terminal window in a corner to see the script output, and Firefox on the rest of the screen | |
# for downloading. | |
set -x | |
while true | |
do | |
sleep 3 | |
echo working | |
file="$(du -k ./*.* | grep -v ".part" | grep -v ".vim" | sort -nr | head -n 1 | awk '{print $2}' | sed "s/^..//")" | |
[[ "$file" != "" ]] && [[ "$(du -k $file | awk '{print $1}')" != "0" ]] && { | |
echo processing $file file | |
[[ "$(/usr/sbin/lsof $file | wc -l | awk '{ print $1 }')" == "0" ]] && { | |
echo $file \ | |
| sed "p;s/[^\.]*./google-photos-download\/$(node -e "console.log(('0000' + (1 + $(ls google-photos-download/*.* | wc -l))).slice(-4))")./" \ | |
| xargs -t -n 2 mv | |
} | |
} | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment