Skip to content

Cloud Storage Delete all files with prefix #680

Description

@javorosas

It would be nice if there was a bulk delete for files that satisfy a query in a bucket. Something like:

myBucket.deleteFiles({ prefix: 'myDirectory/' }, callback);

Activity

  1. jgeewax commented on Jun 19, 2015

    @jgeewax
    Contributor

    Since there's no API call for this, it'd really be a shortcut for...

    bucket.getFiles({ prefix: 'directory/'}, function(err, files, ...) {
      for (var i in files) {
        files[i].delete();
      }
    });

    which could be super misleading about what's actually happening, and might fail half-way through (it wouldn't be an atomic operation). That said, I'll leave this open for discussion...

    /cc @stephenplusplus : This (to me) feels like the whole "delete bucket even if it isn't empty" thing where people are going to do it, so we might as well help them do it right (and then if we add an API call to do such a thing, we can swap it for that under the hood without anyone caring).

    /cc @Capstan : Any chance we're going to add a long-running operation to delete multiple files in a single request using the same query parameters we provide to Objects:list?

  2. added
    type: questionRequest for information or clarification. Not an issue.
    api: storageIssues related to the Cloud Storage API.
    on Jun 19, 2015
  3. stephenplusplus commented on Jun 22, 2015

    @stephenplusplus
    Contributor

    I think this is a good idea. Will PR.

  4. Capstan commented on Jun 22, 2015

    @Capstan

    @jgeewax Support for additional long-running operations is on our roadmap, yes. As for what the method looks like is still undecided. It may not look like list objects at all. It may cleave more to lifecycle management instead. If you have some specific use cases / design goals in mind, it'd be helpful. (e.g., do you care about people adding objects after the operation starts being deleted or not?)

  5. 1 remaining item

  6. added a commit that references this issue on Mar 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

api: storageIssues related to the Cloud Storage API.type: questionRequest for information or clarification. Not an issue.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions