googlephotos 1.1.4

There is a newer version of this package available.
See the version list below for details.
dotnet tool install --global googlephotos --version 1.1.4
                    
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest
                    
if you are setting up this repo
dotnet tool install --local googlephotos --version 1.1.4
                    
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=googlephotos&version=1.1.4
                    
nuke :add-package googlephotos --version 1.1.4
                    

CasCap.GooglePhotosCli

googlephotos is an unofficial Google Photos command-line tool for uploading local media and managing the albums and media created by its OAuth application. It is distributed as a .NET global tool for users who supply their own Google OAuth desktop client.

CI NuGet version

Google Photos Access Limits

Google's Photos API restrictions, checked on 20 October 2026, constrain this tool and its underlying CasCap.Api.GooglePhotos library:

  • The Library API can only see albums and media items created by this tool's own OAuth client. Content added outside that application is invisible to it.
  • Reading an entire library, and therefore whole-library duplicate detection and whole-library backup, is no longer possible.
  • Library API sharing and shared-album operations were withdrawn entirely.
  • Existing user media requires interactive selection through the Picker API. This CLI has no Picker command; configuring a Picker scope does not add one.

albums list --duplicates detects duplicate album titles among app-created albums, not duplicate photos. There is no whole-library backup, sync, duplicate-media scan or sharing command.

Quick Start

Install the .NET SDK to manage global tools and the .NET 10 runtime to run this net10.0 tool, available from NuGet:

dotnet tool install --global googlephotos
googlephotos --help

For an existing installation:

dotnet tool update --global googlephotos

After Google Cloud setup and configuration, googlephotos albums list authenticates and displays only app-created albums. The initial browser consent cannot be replaced by --yes.

Google Cloud setup

  1. Create a project in the Google Cloud console.
  2. Open APIs & Services > Library and enable Google Photos Library API.
  3. Configure the OAuth consent screen and create an OAuth client ID of type Desktop app.
  4. Note the client ID and client secret; they are supplied through configuration below.

Full setup guidance lives in the library documentation.

Configuration

The concrete GooglePhotosOptions configuration is bound at CasCap:GooglePhotosOptions. The host configuration loads, in ascending precedence, shipped appsettings.json, working-directory appsettings.json, the tool's .NET User Secrets, and environment variables. Command-line options do not provide credential overrides.

Do not edit the installed tool store. For the current checkout, supply credentials in your shell:

$env:CasCap__GooglePhotosOptions__User = "your.email@example.com"
$env:CasCap__GooglePhotosOptions__ClientId = "000000000000-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.apps.googleusercontent.com"
$env:CasCap__GooglePhotosOptions__ClientSecret = "your-client-secret"

User, ClientId, ClientSecret and a nonempty Scopes array are required. The shipped file already selects all three Library API scopes below. Set only the scopes you need, but note that title lookup and upload-to-album operations also read existing app-created albums.

Configuration Examples

A minimal working-directory appsettings.json for read-only listing/downloading (replace the synthetic credentials locally and keep the file out of Git):

{
  "CasCap": {
    "GooglePhotosOptions": {
      "User": "user@example.com",
      "ClientId": "000000000000-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.apps.googleusercontent.com",
      "ClientSecret": "replace-locally",
      "Scopes": ["ReadOnlyAppCreatedData"]
    }
  }
}

For upload and album management, this complete configuration includes the shipped scope set:

{
  "CasCap": {
    "GooglePhotosOptions": {
      "User": "your.email@example.com",
      "ClientId": "000000000000-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.apps.googleusercontent.com",
      "ClientSecret": "your-client-secret",
      "Scopes": [
        "AppendOnly",
        "ReadOnlyAppCreatedData",
        "EditAppCreatedData"
      ]
    }
  }
}
Scope Needed for
AppendOnly Create media items and albums; title-based lookup also needs app-created read access
ReadOnlyAppCreatedData albums list, albums download, mediaitems list
EditAppCreatedData Adding uploaded media items to albums

OAuth opens browser consent when a reusable grant is unavailable. The library refreshes stale access tokens; the client ID/secret are still required, not a service-account or API-key substitute. Google can expire or revoke refresh grants; see OAuth refresh-token limits, including the seven-day limit for external apps in Testing with these scopes.

The current checkout defaults the Google authentication cache to %APPDATA%\googlephotos\auth on Windows (the platform application-data equivalent elsewhere). FileDataStoreFullPathOverride can select a different tool-owned directory. googlephotos logout recursively deletes that entire configured directory, not just one account, and does not revoke Google's server-side authorization. It avoids login but still resolves validated options, so keep valid configuration for logout.

Usage

Every command has context-sensitive help:

googlephotos --help
googlephotos albums --help

Albums

# list the albums this tool created
googlephotos albums list

# show only albums which share a title with another album
googlephotos albums list --duplicates

# create an empty album
googlephotos albums add -t "my album title"

# download an album's media items
googlephotos albums download -t "my album title" -o ./download

# download resized, cropped copies retaining EXIF except location metadata
googlephotos albums download -t "my album title" -o .\download --maxwidth 100 --maxheight 100 --crop --exif --overwrite

Media items

# list the media items this tool created
googlephotos mediaitems list

# upload a folder tree
googlephotos mediaitems upload -s ./photos

# upload only JPEGs, into a named album, without prompting
googlephotos mediaitems upload -s .\photos --pattern "*.jpg" -t "Example album" -y

# assign each file to albums named for its ancestor folders below the source root
googlephotos mediaitems upload -s ./photos --hierarchy

Sign out

googlephotos logout

Command Contract

Command and defining source Required options Additional options and behavior
albums list None --duplicates filters repeated titles, case-insensitively
albums add -t / --title Get or create by title
albums download -t / --title -o / --output defaults to the current directory; -y / --yes creates it without prompting; -w / --maxwidth, -h / --maxheight, --crop, --exif, --overwrite
mediaitems list None Lists app-created media as a console table
mediaitems upload -s / --source --pattern defaults to *.*; -t / --title, -h / --hierarchy, -y / --yes, -d / --delete
logout None -y / --yes skips the local deletion prompt, not credential validation

There is no stable machine-readable JSON output mode. Commands emit human-readable tables, progress and error messages.

Transfer Behavior

  • Upload recursively selects supported files, asks for confirmation unless --yes, uploads bytes, creates media items, then assigns albums. --title takes precedence over --hierarchy; files at the hierarchy root get no derived album.
  • Duplicate app-created album titles block title-based upload assignment. There is no persistent upload journal or whole-library deduplication.
  • --delete is destructive: it deletes local files whose media-item creation succeeded, even if album assignment later reported failure. Album-assignment failure does not independently make the process fail.
  • Download skips existing filenames case-insensitively, without comparing contents; --overwrite re-downloads them. A missing/expired album URL can fail the command, but an individual download returning no bytes is skipped and the overall command may still return success. This is not a verified archival backup.
  • Parsing, option validation and authentication failures return 1; ordinary successful or declined/no-work operations generally return 0. Do not treat that as a guarantee that every transfer or album assignment succeeded.

Data Flow

flowchart TD
    A(["Configured CLI command"]) --> B["Browser consent or cached OAuth grant"]
    B --> C{"Operation"}
    C -->|Upload| D["Local files: upload bytes"]
    D --> E["Create app-owned media items"]
    E --> F["Optional album assignment"]
    F --> G["Optional local deletion after media creation"]
    C -->|List or download| H["Library API: app-created content only"]
    H --> I["Console table or local download files"]

The diagram describes Library API operations, not a Picker or whole-library path. All essential behavior is also explained in text for package renderers without Mermaid support.

Development

Use the .NET 10 SDK. The source delivery-unit README covers host wiring; the test README covers the offline suite.

dotnet build CasCap.GooglePhotosCli.Release.slnx -c Release

The Debug configuration resolves CasCap.Api.GooglePhotos through a sibling local project reference. Release uses the published NuGet dependency; no sibling checkout is required.

Feedback and issues

Please raise anything on the GitHub issues page.

License

This project is released under the MIT License.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

Version Downloads Last Updated
1.2.0 129 11/14/2026
1.1.6 117 11/5/2026
1.1.5 128 11/1/2026
1.1.4 132 10/24/2026
1.1.3 139 10/4/2026
1.1.2 122 9/26/2026
1.1.1 119 9/23/2026
1.1.0 126 9/19/2026
1.0.1 120 9/11/2026
1.0.0 145 9/4/2026
0.1.19 1,042 10/8/2022
0.1.18 794 10/8/2022
0.1.15 668 7/18/2021
0.1.13 950 6/6/2021