Protect what matters – even after you're gone. Make a plan for your digital legacy today.
Forum Discussion
Former Member
4 years agoIs there a faster way to empty a vault using CLI2?
Hi, I have a requirement to empty certain vaults periodically and then refill them. I'd rather not delete the vault and recreate it and all the permissions if possible.
For a vault with 500 items ...
zcutlip
3 years agoDedicated Contributor
Just wanted to update this issue with the release of pyonepassword 3.6.0. The main feature in this release is a result of this community question: OP.item_delete_multiple().
OP.item_delete_mutiple() gives you a number of selection criteria, starting with vault but including tags, categories, and title_glob, which is a shell-style glob-pattern
Deleting via item_delete_multiple() is substantially faster than looping over a list of items and deleting one at a time.
It defaults to a batch size of 25 items, which is to say 100 items gets deleted in four passes. It's worth experimenting with the batch_size kwarg to see if there's a more optimal size for your use case.
You can install it from PyPI and read about it here:
https://pypi.org/project/pyonepassword/3.6.0/