Delete all Files in a Bucket with the CLI
- Print
- DarkLight
Delete all Files in a Bucket with the CLI
- Print
- DarkLight
Article Summary
Share feedback
Thanks for sharing your feedback!
You can delete all of the files in a bucket using the command-line interface (CLI). This task assumes that you are using the Python version of the CLI.
- Download and install the CLI.
- Open a Terminal window.
- Run this command:
b2 authorize-account [<KeyID>] [<ApplicationKey>]
- Run this command:
b2 rm --versions --recursive <bucketName>
wherebucketName
is the name of the bucket you want to empty.
Warning
Step #4 will delete all files, file versions, and subfolders in the bucket.
Note
If there are still unfinished large files in the bucket, this method by itself will not remove those unfinished listings. The bucket may still report as not empty.
To remove unfinished large files, call
To remove unfinished large files, call
b2 cancel-all-unfinished-large-files <bucketName>
and delete the bucket again.Was this article helpful?