Created
May 22, 2021 15:27
-
-
Save peterrus/cb9217401c12240ea36581bd98521133 to your computer and use it in GitHub Desktop.
Bitwarden full export (with attachments)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -e | |
FOLDER_NAME=bw-export-$(date "+%Y%m%d-%H%M%S") | |
mkdir $FOLDER_NAME | |
cd $FOLDER_NAME | |
export BW_SESSION=$(bw unlock --raw) | |
bw sync --session $BW_SESSION | |
bw export --output ./bitwarden.json --format json # bw export does not seem to accept the --session parameter, so you have to enter your password here again | |
bash <(bw list items --session $BW_SESSION | jq -r '.[] | select(.attachments != null) | . as $parent | .attachments[] | "bw get attachment --session $BW_SESSION \(.id) --itemid \($parent.id) --output \"./attachments/\($parent.id)/\(.fileName)\""') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment