Moving items using command line
How can I move an item between vaults using the command line tool?
We use LastPass shared folders heavily for sharing passwords among small functional teams. A folder is the unit of sharing in LastPass. It seems that a vault is the only sharable unit in 1Password.
Because of my role, I personally have 1500 items in 116 shared folders, each with a different scope; within the company there are perhaps 100 more folders with another 2000 or so items. Obviously to make a straight-through conversion to 1P we need to script it. When I import from LastPass CSV, all items go into a single vault, but are tagged according to their original folder. When I use op list
I can get JSON showing item UUIDs and tags. Given this information how can I move an item to a different vault to complete the migration?
1Password Version: 0.10.0
Extension Version: Not Provided
OS Version: Not Provided
Sync Type: Not Provided
Comments
-
Hi @dgc, there isn't a way to move items between vaults with a single command in the current CLI version. At the moment, you'll have to create a copy of the item in the new vault and remove the old one. You can use
op create item
to create the new item andop delete item <item>
to delete the item. In your language of choice, you can parse the JSON output fromop
to copy over the information into the new item. I'm personally a Node/Typescript fan, which usesJSON.parse()
.I've uploaded one approach you could take to this using Python here. There are a few things to keep in mind with my approach though, namely that any tags in copied items won't be transferred with my approach, only the first website URL will be moved over, and it won't work if you're using
--shorthand
with the CLI. I'd recommend taking a look at how it works and writing your own version to ensure it meets your needs. Let us know if you have any questions! :smile::+1:0