51e1a6da0be971d007bb994deed769ee35d29dfd
Immich to cloud exporter
Script to export immich data as a structured folder. Useful if you want to browse your albums etc when immich is broken.
To-do
- Create folders like "Misc {{year}}" for photos that are not in albums
- Delete assets that are deleted in Immich but exist on the local disk
- Dockerize the tool so it's easy to run on the server
- Stretch: Preserve metadata (e.g. file creation times)
- Stretch: directly sync to Proton Drive (skipping the local filesystem)
Usage
Docker
You can build and run this tool using Docker:
# Build the Docker image
docker build -t immich-to-cloud-exporter .
# Run the container
docker run -it --rm \
-e IMMICH_HOST=http://your-immich-server:2283/api \
-e IMMICH_API_KEY=your_api_key \
-v /path/to/local/export:/app/export \
immich-to-cloud-exporter
To run with the dry-run flag:
docker run --rm \
-e IMMICH_HOST=http://your-immich-server:2283/api \
-e IMMICH_API_KEY=your_api_key \
-v /path/to/local/export:/app/export \
immich-to-cloud-exporter --dry-run
Build and publish
docker build -t immortaly007/immich-exporter .
docker push immortaly007/immich-exporter
Development
Generate OpenAPI spec
Only the Albums, Assets, and Search APIs are generated (the only ones this
tool uses) and docs/tests are skipped, to keep the generated client small.
The generator version is pinned to v7.9.0 because newer versions ship a
codegen bug that drops the field_validator import from some pydantic
models; scripts/fix_field_validator_imports.py patches around it.
rm -rf generated/immich
docker run --rm \
-u $UID:$UID \
-v ${PWD}:/local openapitools/openapi-generator-cli:v7.9.0 generate \
-i https://github.com/immich-app/immich/raw/refs/heads/main/open-api/immich-openapi-specs.json \
-g python \
--global-property apis="Albums:Assets:Search",models="",supportingFiles="",apiTests=false,apiDocs=false,modelTests=false,modelDocs=false \
--additional-properties generateSourceCodeOnly=true,packageName="generated.immich.openapi_client" \
-o /local/
python3 scripts/fix_field_validator_imports.py
Description
Script to export immich data as a structured folder. Useful if you want to browse your albums etc when immich is broken.
Languages
Python
100%