Skip to content
an app to download pictures and videos stored in your Google Photos
Go Shell
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


An app to download pictures and videos stored in your Google Photos.

This app is a fork of Denis Vashchuk's project.

Table of Contents

How it works

gphotosync downloads all the content of your Google Photos library to a local directory (current directory by default, otherwise to the one specified with -lib [path] command line option. It creates year/month/ directory structure. If two files with the same filename happen to fit into the same month, the most recent one will be saved under its original filename, while the rest will have timestamp appended, so the directory structure will look something like this:

+-- 2019/
|  +-- 07/
|  |  +-- 01.jpg
|  |  +-- 02.jpg
|  |  +-- 20190704.JPG
|  +-- 05/
|  |  +-- VIDEO.MPG
|  |  +-- VIDEO-gphotosync-159b90e8a152aa00.MPG
|  |  +-- VIDEO-gphotosync-159e8e0cdc16be00.MPG
|  +-- 01/
|     +-- IMG512.JPG
+-- 2018/
|  +-- 12/
|  |  +-- IMAGE01.JPG
|  +-- 11/
|     +-- 0001.jpg
|     +-- 0004.jpg

The appended value is by default a hex representation of Unix timestamp. You can use -strategy id command line option to append Google Photo ID of the media file instead of timestamp.


If you are planning to use the app for scheduled backups (which is totally OK), please consider the following:

  • It's not a good idea to schedule these backups to run on the hour (i.e. at 3:00, 10:00, 17:00, etc.), and it's even worse to schedule them for midnight. If enough people do that, Google servers will have to process a lot of requests from all of us at the same very second; eventially Google will ban the API key. The app already has a random delay (between 0 and 60 seconds) before it starts, but you can help things more if you schedule the runs for some random minute of the hour.
  • If the limit for Google API requests per day is reached, the app will pause for a minute before retrying to request more files, then for 2 minutes, then for 4 minutes, and so on, and so on. If a lot of users use the same pre-compiled project key, the delays can get significant, so it's a good idea to use some kind of blocking so that your new backup doesn't start before the previous one is finished. Linux users are advised to use setlock in their cron jobs.


You can use your own project's credentials for authentification: create a project using Photos Library API in Google Developers Console, download JSON credentials file from ID page, rename it to .client_secret.json and put in the directory where your local photos library will be downloaded. If no .client_secret.json is found in the working directory, the credentials supplied at build time will be used.

Building the app

$ ./

or, if you're running a non-proper-shell-capable OS (i.e. Windows)

go run build.go oauth.go

If you want authentification credentials compiled in, have a .client_secret.json in repository directory at compile time (see Authentification section for details).

Privacy considerations

If you're using the precompiled version of the app with builtin project credentials, the activity of your copy of the app will be included in what I see in my Google Developer Console (it shows the cumulative activity such as number of requests per hour or day, median delay in serving those requests, and so on; I'm not aware of any way to see any personal or personalized data there). Other than that no one (but Google and your ISP or VPN provider, of course) has any way to have any access to your stuff or collect any data about how you are using it. Hey, you can read the source code and see for yourself what it does, and you can recompile the code yourself just to make sure!


This software includes the following software or parts thereof:

You can’t perform that action at this time.