gphotos-sync Is a command line tool for backing up Google Photos (including separate photo albums) using the Google Photos Library API for Linux, macOS and Windows. Use it regularly to grab all newly added photos and keep a full Google Photos backup on your server or desktop. This tool is especially useful after Google announced that Google Photos will stop syncing with Drive starting July 10, 2019, which means that some tools that backup Google Photos to your computer will stop working ( influences For example, Insync, a commercial Google Drive client running on Linux, macOS, and Windows.
gphotos-sync can back up all photos uploaded by users to Google Photos, as well as other photos automatically created using Google Photos, such as animations, panoramas, movies, enhanced photos or collages. This application is only for Google Photos download / backup purposes. It cannot upload photos to Google Photos.
The first full sync will create 2 directories:
- Photos with all Google Photos and videos organized by year / month subfolder structure (
- Albums, which contains a folder hierarchy representing albums and shared album collections in your library (
albums/YYYY/MM Original Album Name). Since this folder contains the same photos as in photos /, the images in album / are symbolic links from the photos in photos /
Subsequent runs of gphotos-sync using the same root folder will refresh the local copy with all new photos added to your Google Photos since the last scan. However, it does not update any photos that have been modified in Google Photos because it is not possible to find the date the image was modified from Google Photos.
Also note that the Google Photos Library API removes GPS data from the image EXIF information ( Open question for this). The gphotos-sync page contains a workaround for this issue, explaining Here , I did not try.
gphotos-sync features / options include:
- Download all your images and videos from Google Photos, including those automatically created by Google Photos (animations, panoramas, movies, enhanced photos or collages)
- Fetch all new photos added to your Google Photos account since the last sync
- (Optional) Download and sync only a single album (using
--album "ALBUM NAME")
- Compare images in your Google Photos account with local folders, such as previous backups. The comparison does not require the files to be in the same folder, it uses metadata from the files (such as the creation date and exif UID) to match the item pairs (using
--compare-folder "COMPARE_FOLDER")Look This link to know more information
- Delete the index database and rescan everything (
- (Optional) Rescan the entire library, ignoring the date of the last scan (
- Check for files marked as downloaded and re-download any missing files. If you delete some local files (
- Skip video while syncing (
- Set file start and end dates to sync in the following format
- Scrape the location metadata of the Google Photos website and add it to the EXIF metadata of the local file (
Before using gphotos-sync, I recommend reading Known issues and limitations .
Install and set up gphotos-sync
See How to install gphotos-sync on Windows .
This tool uses Google Photos API and requires you to create a new Google Cloud project, enable Photos API for your project and set OAuth 2.0 for it, so you can use your own API key to avoid encountering API restrictions. The API still has limitations, but this way you will be the only one using it. The first part of the following guide is for installing gphotos-sync, and the second part is for using your own API key with gphotos-sync (it would not be possible without this feature). gphotos-sync Using pipenv on Linux:
1. Install pip3:
sudo apt install python3-pip
sudo dnf install python3-pip
- Arch Linux, Manjaro:
sudo pacman -S python-pip
sudo zypper install python3-pip
~/.local/bin If you haven’t already, put it in your PATH (store the executable file of the package installed using pip3 here):
- For Bash:
echo "export PATH="$PATH:$HOME/.local/bin"" >> ~/.bashrc . ~/.bashrc
- For Zsh:
echo "export PATH="$PATH:$HOME/.local/bin"" >> ~/.zshrc . ~/.zsh
3. Install pipenv, create a folder named gphotos-sync in your home directory, and install gphotos-sync using pipenv:
python3 -m pip install pipenv mkdir ~/gphotos-sync cd ~/gphotos-sync pipenv install gphotos-sync
You can now run gphotos-sync, for example:
pipenv run gphotos-sync
You need to
~/gphotos-sync Folder (so you must
cd ~/gphotos-sync And then use
pipenv run gphotos-sync ). You can use other folders / paths, but remember to replace all occurrences
~/gphotos-sync Use your custom location in this guide. Create a Google Cloud project, enable the photo gallery API and create an OAuth client ID:
1. Create a new Google Cloud project
go with https://console.cloud.google.com/cloud-resource-manager And create a new project.
For help with this step, see Google Cloud documentation to create a project https://cloud.google.com/resource-manager/docs/creating-managing-projects
2. go to https://console.cloud.google.com/apis/library?project=_ , Select a project, then search the Photo Gallery API and enable it for this project.
Google Cloud help on enabling APIs can be found here: https://cloud.google.com/apis/docs/enable-disable-apis
3. go to https://console.cloud.google.com/ , Make sure the correct item is selected from the top drop-down menu, then click APIs and Services in the sidebar, and finally click Credentials in the sidebar. Create an OAuth client ID. When asked to select an application type, select Other.
You can see the complete process on setting up OAuth 2.0 with the new project on https://support.google.com/cloud/answer/6158849
4. After creating the client ID, download it as client_secret.json (so rename it because it will have a longer name) and save it under the application configuration directory:
- ~ / Library / Application Support / gphotos-sync / under Mac OS X
- Under Linux ~ / .config / gphotos-sync /
- C: Users
AppData Local gphotos-sync gphotos-sync under Windows
It’s time to run your initial full Google Photos backup to your computer. To do this you need to run
pipenv run gphotos-sync inside
~/gphotos-sync Folder, then the path where the tool should download all Google Photos. For example, to download all Google Photos to
~/gphotos-sync Folder, use:
cd gphotos-sync pipenv run gphotos-sync ~/gphotos-sync
When you run gphotos-sync for the first time, you need to authorize with your Google (Photos) account and a link will be displayed in the terminal.
You need to copy the link displayed in the terminal and paste it into your web browser. It will display a page “This app has not been verified by Google.” This is normal because the app uses your API key and you did not submit it to Google for verification. While on this screen, click
Advanced ,then click
Go to Your_Gogle_Cloud_Project_Mame (unsafe) . Please click
Allow When prompted, copy the code shown on the Google OAuth page, paste it back into the terminal, and press
Run the same command (
pipenv run gphotos-sync ~/gphotos-sync Every time you want to update the local backup of Google Photos, click in the gphotos-sync folder in my example. It’s worth noting that after uploading a new photo to Google Photos (for example, using the web interface or via a mobile phone), you need to wait for a while as it will not be immediately available for download / backup.
See the application’s help (
pipenv run gphotos-sync --help ) For advanced usage and more options.