Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[question] Delete all file in folder or starting with /folderName #26

Closed
billouboq opened this issue Mar 24, 2017 · 2 comments
Closed
Labels

Comments

@billouboq
Copy link

billouboq commented Mar 24, 2017

Hi,

Sorry to ask this here, but b2 is new so not a lot of people are responding on stackoverflow.

Do you know any solution to delete all files in a folder (so with name starting with "folder/") ?

I guess I have to do a listFile starting with "folderUrl" and then for each file a delete file version call.

@jaredreich
Copy link
Contributor

@billouboq you can get all the files with listFileNames (passing the bucketId param), then filter those files that start with the folder_name/ you want, then loop through them and for each one perform the deleteFileVersion (passing the fileId and fileName params)

@odensc
Copy link
Collaborator

odensc commented Jan 17, 2019

As @jaredreich said, that's probably the best way to do it! If you have an issues with that method please reopen.

@odensc odensc closed this as completed Jan 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants