How can I delete multiple duplicates of account data?

I have multiple numbers of the same accounts. How can I manage to merge or delete it in quickest way? Like in LastPass

1 Like

Hello! You could do it via Web vault.

Comment par le coffre ? je cherche depuis hier ! et ne trouve aucune facon de supprimer ! Ni corbeille Ni poubelle !

@Lordami How we can do it by single click to remove duplicate entries?

1 Like

Unfortunately there is no easy way to do it.
You can remove duplicates via Web vault. Or you can export them to csv file, edit it (e.g sort by name and delete unnecessary items).
It is more tricky and unsafe, but doable. Before importing back, you’d need to clear the Vault.

1 Like

Easiest way I found is to export your vault to lastpass (free account) as a .csv it will remove duplicates as that is auto checked, then import back to Bitwarden again using lastpass export tool! Phew!! sounds complicated but takes 5 minutes!

5 Likes

bonsoir, faites un export csv et faite un trie depuis un tableur comme excel. quand vous avez terminé faites un import en repectant .csv lors de l’enregistrement du fichier.

1 Like

Thanks a lot for your tip… worked perfectly!

You can use this simple script:

I found this to be the easier workaround, especially for those of us who are not comfortable with programming.

  1. Export your data as csv
  2. Using a spreadsheet or text program open the CSV file and verify all your data is there. Then manually delete/update as needed (be careful not to delete first row or first column as these are the title row and folder column), and save. (I recommend to save with a different filename to preserve the original, in case you need to go back to it). Ensure it’s saved back as a .csv file.
  3. on Bitwarden web page go to your account and to the “Danger Zone” section at the bottom. Do a Purge Vault (This will erase all your files from the vault. Verify all your data has been erased.
  4. Go to Tools and Import your newly updated file as Bitwarden CSV file
  5. Verify your data has been uploaded.

If you don’t run into any issues, you should have your newly updated files. It’s important to always verify each step to ensure your info is there and you don’t lose your data.

Hope this works for you all as it did for me.

1 Like

Even simpler no-dependencies script GitHub - DustinWehr/minimal-bitwarden-dedup: Easy-to-review script to remove exact duplicates from a BitWarden vault and instructions for doing this safely.

1 Like

What is the logic for bitwarden too not offer a button to do this? Is there some value to having duplicate entries? I can’t think of any value!

So there people have to go risking this and risking that just to squeeze out the duplicates.

2 Likes

Why clutter up the UI with a button for something that will be rarely used? Duplicates are an issue mostly for people who had problems with importing items from another password manager, or for people who try to auto-save logins while their vault is locked. If the latter group can break that habit (or extend their vault time-out period), then this really boils down to a one-time task for the former group. You can already do bulk delete of multiple items at once via the Web Vault app, so that should be sufficient to cover their use-case.

1 Like

IN the process of migrating from LastPass until I found this very basic feature does not exist yet :neutral_face:
Disappointing to see it was promised on the roadmap by 2020 and there is still no progress, even for a rudimentary and simple check.
Going to make me think twice about the migration :roll_eyes:

Hey there! As a work around, prior to importing, you can search the CSV or JSON for duplicates before importing. The CLI can also be used with custom scripts for additional functionality.

Because, in those rare instances, it would be very useful! It’s built into other password managers. Why not BitWarden?

1 Like

Bitwarden has an API so doing this with a script would be easy, and thanks to chatgpt it’s never been easier.

However, bitwarden also has a command line tool. You can download it from bitwarden. It’s easily installed on Ubuntu from the Software app as it is packaged as a snap although I only tried that after downloading the executable from bitwarden, and I kept using the one I downloaded from bitwarden since this was the one I used to login. That’s why my examples should all refer to ./bw but if I had used the snap version instead, I could just have done bw

This method requires using the command line tool and some command line techniques. These skills can be used again for other admin tasks. In the past only a small number of users bothered to learn these things, but thanks to chapgpt it has become much easier.

You have to login to bitwarden first (from the command line), which is pretty easy. I logged in with my email address and password, and entered the TFA code. Pretty much the same as usual, except at the command line.

Then follow the instructions to export the session_id you get after logging in.

Using linux, you can get a list of the the IDs of duplicate entries as below. And I am not a wizard, this is with the assistance of chatgpt. Linux is really good for “power users” since you can chain commands together and chatgpt makes all this stuff very accessible. I believe that macos (which is based on unix) and Windows PowerShell should be equivalent. This relies on the jq tool which processes the “json” output you get from the bw command.

I have found the correct organizationid and collectionid by using

.\bw list organizations and similar for collections
Then I put them into temporary variables to save time using export.
export colID 1234 although of course don’t use 1234; use the value you got from the list command.

I used the organizationid and collectionid filters because I wanted to remove duplicated entries for a specific collection in a specific organization. I guess if you are not using these features, you could just not use the filters, which makes things simpler.

macos would be the same, PowerShell I don’t know.

The command below finds a list of duplicates and returns the first one. Ideally it should return all but one of the duplicates, but I have double-ups, not worse than that. If you have worse duplicates, you could repeat this until there are none left, or come up with a smarter command.

./bw list items --organizationid $orgid --collectionid $colID | jq 'group_by(.name + .login.username + .login.password) | map(select(length > 1) | .[0]) | map(.id)'

[if you want to see the full information about duplicate records, to check what it’s doing, remove the final | map(.id)[] bit, because that part filters the output to show only the id value]

This defines a duplicate entry as having the same name, username and password. I don’t know how it behaves for entries that don’t have login names and passwords.

actually, you need to save this list so you can delete the IDs.
Hence

export DUP_IDS=$(./bw list items --organizationid $orgid --collectionid $colID | jq -r 'group_by(.name + .login.username + .login.password) | map(select(length > 1) | .[0]) | map(.id)[]')

(this has some other changes suggested by chatgpt to get a simple list of IDs separated by a space).

After saving all the duplicate IDs in the shell variable DUP_IDS, can be deleted with the one liner:

echo "$DUP_IDS" | xargs -t -I {} ./bw delete item {}

doing echo "$DUP_IDS" and not echo $DUP_IDS is important in the bash shell of Ubuntu. Without the quotes, the spaces in between each ID element get lost. Guess how I know that.
This deletes by moving to Bitwarden’s “trash”; they are permanently deleted in 30 days.

Note that you could combine these two steps into one step to get a famous one-liner.

It processes one per second, which looks like the bw command is doing rate limiting.