How to move lot of items into an existing collection?

I imported 2000 plus items from another password manager tool to bitwarden. Although I can move one item at a time to an existing collection, I do not see how I can move them all to an existing collection at the same time.

1 Like

Hi @tony.o , welcome to community! :wave:

The easiest way to do this is in the web vault - from the My vault view youā€™ll be able to multi-select and move all the items selected to the Collection(s) of your choice!

Just keep in mind that all of the items selected need to be move to the same Collection(s), but you can use the same feature again to move the rest of your items elsewhere.

Hi.
When I do this I get this message:
ā€œYou have selected 2 item(s). 0 item(s) can be moved to an organization, 2 cannot.ā€
It seems that I can move items from ā€œMy Vaultā€ to one of the companyā€™s collections but I cannot move from one collection to another. Am I doing this right?
Thanks

@tony.o if the item already belongs to an Organization then you should be able to see and edit which Collections that item is in with the use of the vertical ellipses ā‹® Options button.

2023-04-25_15h39_43 2023-04-25_15h39_58

Hey @tony.o you can currently bulk select and move from your individual vault to the organization, but not between existing collections in the organization.

The team is working on upcoming changes to resolve this issue, stay tuned!

5 Likes

Is this already implemented, and maybe just broken? Iā€™m trying to move items from a collection into a subcollection (cleanup an unweildly large collection). I see thereā€™s select tickboxes, and thereā€™s nothing those boxes could possibly apply to other than the overflow menu items to the right of individual items. Am I right to assume that I should be able to select items a, b, c, select overflow from c and move to a collection, that all three of the items should make the move?

If so, thatā€™s not what happens right now :expressionless: If not: what is that select/tickbox for then?

1 Like

We really need the ability to bulk-move items between collections in the organization. Without it, hundreds of items get stuck in the Unassigned collection whenever you try to reorganize your vault. What a pain.

7 Likes

I want to add my ā€˜voteā€™ for this to be implemented. I find myself with a few hundred items in ā€œUnassignedā€ that I want to move to an organization. If I select multiple items, then the only option the group-select menu offers is ā€œDelete selectedā€.
(When I select a single item, then the menu for that item includes several options, including ā€œCollectionsā€, in addition to ā€œDeleteā€.)

Maybe thereā€™s an architectural reason why multiple items canā€™t be moved to a collection in a single operation. But if thereā€™s a way to do it, I think future generations of users would appreciate it.

2 Likes

Here is how I got around this issue using the bitwarden cli and jq. This works on mac/linux.

I want to move all items into a new collection that are in another collection (and are in that collection only) and that match my search criteria.

bw list items --collectionid=d7dbf3f3-c1f7-4945-af6e-b10401451bd4 --search "my search" \
  | jq -r 'map(select(.collectionIds==["d7dbf3f3-c1f7-4945-af6e-b10401451bd4"]) | .id).[]' \
  | xargs -I% bw edit item-collections % $(echo '["2a62d2b5-4814-477f-ab49-b10701515bae"]' | bw encode) \
  | tee /tmp/results.json.stream | jq '.id'

The last line suppresses the passwords from being printed on screen; just the ids.

This took a pair of minutes to bulk move a few hundred items.

To do a dry-run: change ā€œbw editā€ to ā€œecho bw editā€.


Line by Line Explanation

bw list items --collectionid=d7dbf3f3-c1f7-4945-af6e-b10401451bd4 --search "my search"

Grab all the items in the original collection that match my search

jq -r 'map(select(...) | .id).[]'

Take all the json array of items, apply a filter over it and print out only the ids.

  • select(...)
    • applies the filter, ignoring everything else that doesnā€™t match the criteria
  • map(... | .id)
    • selects only the id of the item
  • .[]
    • moves the items out of an array into a stream
  • -r
    • strips the quotes from the ids
select(.collectionIds==["d7dbf3f3-c1f7-4945-af6e-b10401451bd4"])

This is the core filter. I only want those items that are in only this filter

echo '["2a62d2b5-4814-477f-ab49-b10701515bae"]' | bw encode

This is the new collection I want the item to be in, base64 encoded as required for bw edit (next)

xargs -I% bw edit item-collections % $(...)

For each id from the above filter, edit its item collection to be that encoded above.

  • xargs -I% ... % ...
  • Each id will be plopped in the command where the % is. I find this the easiest way to work with xargs
  • bw edit item_collections <id> <update>
  • make the change!
  • $(echo ... | bw encode)
  • This is wrapped in shell execution because bw edit needs the result as part of its parameters.
tee /tmp/results.json.stream | jq '.id'

I donā€™t like my passwords being printed to the screen.

  • tee
    • dumps the results in a file
  • jq '.id'
    • selects only the id and prints it

Yeah, this still sucks in March, 2024 - importing a ton of items from a competing password management solution, and itā€™s a pain to reorganize into collections without some sort of bulk action option. I can select multiple items, but there doesnā€™t seem to be a bulk action option.

Very disappointing it takes this long for Bitwarden to create something so important for Organizational Administrators.

In the meantime, inspired by grignaak , I have created a bash script that is a bit more readable for newbies out there.

Note: This is for moving ALL items from being assigned in one vault to another. It may need a couple tweaks, if you run into any bugs. But from testing, it worked really well.

Just donā€™t forget to login to the Bitwarden CLI extension first.

I still wish Bitwarden will implement bulk transfers, because the below script does ALL entries. Iā€™d like to cherry pick specific logins from a vault collection, and move them in bulk.

#!/bin/bash
# Bulk update an entire collection of entries to a new Collection ID using sed (Without affecting it's current list of already assigned Collections)
# IMPORTANT NOTE: !! YOU MUST !! You must have access to the source collection ID and destination collection ID!
#   This is because specifying a bitwarden CLI search of a collection ID, will include results of items part of the collection but shared to you via a seperate collection.
#   You're better off creating an 'Owner' account you can designate logging into BW CLI, so you don't have to assign all collections to a regular user.
#   Note: Having Organizations vault access as Owner/Admin isn't the same access:
#       You must still assign ALL the collections to the user, so it shows on their personal vault side as a shared organization login.
 
export BW_ORGANIZATION=12345678-abcd-efgh-1234-13afc3ed3e45
export BW_OLD_COLLECTION=123e96b3-5cd9-411c-8048-b1e0d9c0d8de
export BW_NEW_COLLECTION=3459fcc5-b72f-4154-89c9-087547486522
 
# Get all items viewable by your account from a specific collectionid, then
#   Replace any occurrence of old collection with new collection ID
BW_ENTRIES_FOUND=$(bw list items --collectionid ${BW_OLD_COLLECTION} | sed "s/${BW_OLD_COLLECTION}/${BW_NEW_COLLECTION}/g")
 
# Loop through the BW entries found, and for each compact line grab specific field entries, then while loop them
echo ${BW_ENTRIES_FOUND} | jq -c '.[] | {id,name,collectionIds}' | while read i; do
 
    # Get entry name (Only used for verbose output)
    BW_EDIT_NAME=$(echo ${i} | jq -r '.name')
 
    #Get entry ID without quotes using -r raw output
    BW_EDIT_ID=$(echo ${i} | jq -r '.id')
 
    # Get entry Collection IDs list
    # Ensure we use -c for compact output (single line per output), bw encode will encode newlines pretty format, but bw edit wont accept it as valid
    BW_EDIT_COLLECTIONIDS_LIST=$(echo ${i} | jq -c '.collectionIds')
 
    # Encode the entry collection IDs list (essentially base64 encoding)
    BW_EDIT_COLLECTIONIDS_LIST_ENCODED=$(echo ${BW_EDIT_COLLECTIONIDS_LIST} | bw encode)
 
    # Now edit the entry to the new collection
    echo "Now Editing entry (${BW_EDIT_NAME}): ID: ${BW_EDIT_ID} | WITH LIST: ${BW_EDIT_COLLECTIONIDS_LIST} | ENCODED LIST: ${BW_EDIT_COLLECTIONIDS_LIST_ENCODED}"
    echo ${BW_EDIT_COLLECTIONIDS_LIST_ENCODED} | bw edit item-collections ${BW_EDIT_ID} --organizationid ${BW_ORGANIZATION}
    echo ""
 
    # Debug mode:
    # Comment out when done testing, this exit lets us debug only editing one entry then exiting
    exit 0
done

@lakjsdf 7 @c11.jake Welcome to the forum!

The most recent release of the Web app (version 2024.3.1) now includes bulk management of items in Collections. For more information, please refer to the Help documentation.

2 Likes

Woohoo that update says 3 days ago on github! Thanks for pointing to the new version.

1 Like

This last update mentioned by @grb is about a bulk assignment of items to a collection which still donā€™t belong to any other collection. What about bulk move from one collection to another via Web Vault? I will give a try with bitwarden cli, but I guess that having it via webui would make the life of ppl which arenā€™t developers by far easier

@galindro Welcome to the forum!

You can do a collection-to-collection move from any Bitwarden app, not just the Web Vault.

One by one or multiple at the same time? I could do one by one via the app and web vault, but not bulk.

Youā€™re right, the method I linked seems to be for moving items one at a time.

Hi @galindro @grb - you can bulk assign items from one collection to another collection via the Web App > Admin Console. This is possible from any collection, not only the unassigned collection. Let me know if you run into any issues!

2 Likes

Yeah! It works. But why only from admin console? That led me to think bitwarden didnā€™t has such a featureā€¦

The bulk action will also be available from the Individual Vault in an upcoming release!

3 Likes