Skip to content

Instantly share code, notes, and snippets.

@simonseyer
Created December 16, 2018 17:32
Show Gist options
  • Save simonseyer/4476d8055064e125d61449ec55109bef to your computer and use it in GitHub Desktop.
Save simonseyer/4476d8055064e125d61449ec55109bef to your computer and use it in GitHub Desktop.
Download all documents from a 1Password vault (macOS)
#!/bin/bash
# Dependencies:
# 1Password cli tool: https://support.1password.com/command-line/
# jq
#
# Usage:
# ./op_download_documents.sh <op_subdomain> <vault_uuid>
#
# op_subdomain: 1Password subdomain (login once via `op signin <signinaddress> <emailaddress> <secretkey>`)
# vault_uuid The UUID of the vault (see `op list vaults` for the correct UUID)
eval $(op signin $1)
op list documents --vault=$2\
| jq '.[] | .uuid,.overview.title'\
| xargs -L2 bash -c '[ ! -e "$1" ] && echo "Downloading: $1" && op get document "$0" > "$1"'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment