Skip to content

Instantly share code, notes, and snippets.

@billwanjohi
Created February 12, 2023 22:21
Show Gist options
  • Save billwanjohi/9df67ed343e17611c0b928c4bc92718d to your computer and use it in GitHub Desktop.
Save billwanjohi/9df67ed343e17611c0b928c4bc92718d to your computer and use it in GitHub Desktop.
#!/bin/bash
set -euxo pipefail
BW_FOLDER=$(bw list folders | jq -rc ".[] | select(.name == \"$MY_FOLDER_NAME\") | .id")
BW_ITEMS=$(bw list items --folderid $BW_FOLDER | jq -rc '.[] | select(.organizationId == null) | .id')
BW_ORGANIZATION=$(bw list organizations --search $MY_ORG_NAME | jq -rc '.[].id')
BW_COLLECTIONS=$(bw list collections --search $MY_COLLECTION_NAME --organizationid=$BW_ORGANIZATION | jq -c '.[].id' | jq -s | bw encode)
echo $BW_ITEMS | xargs --replace={} bw move {} $BW_ORGANIZATION $BW_COLLECTIONS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment