supabase / storage

S3 compatible object storage service that stores metadata in Postgres
https://supabase.com/docs/guides/storage
Apache License 2.0
806 stars 115 forks source link

enable from.remove() to delete folders #207

Open RyanTippsTX opened 2 years ago

RyanTippsTX commented 2 years ago

Feature request - delete folders

Is your feature request related to a problem? Please describe.

With supabase storage, folders are deleted automatically when their contents are deleted, but there's no way to delete a whole folder at once, and there's no (clean) way to delete empty folders.

Describe the solution you'd like

I would like for this to work:

const { data, error } = await supabase.storage
  .from('bucket')
  .remove(['path/to/folder'], {
    force: true, // required if folder isnt empty
  });

Describe alternatives you've considered

For 'empty folders' that were created in the supabase web app, they can apparently be deleted like this:

const { data, error } = await supabase.storage
      .from('bucket')
      .remove(['folder/.emptyFolderPlaceholder']);

^ but this is clunky, and you have to know that that placeholder file is there.

And for deleting a folder that has multiple contents, it can be done much more verbosely using .list() and .remove() , but this is a pain, especially if there are nested folders.

fenos commented 2 years ago

Hello @RyanTippsTX thanks for the feature request! This is something we are exploring and are very eager to implement in near future.

We are just finalizing a few requirements before we get there, for example, we'll need a queue-worker implementation for this to be working reliably.

The good news is that we are already building another feature that requires queue workers, so this will be the next one!

madeleineostoja commented 2 years ago

Excellent to hear @fenos, this is a pretty basic requirement and I was surprised to see it's not implemented. Passing every file in a folder to remove in a single array call feels error prone, especially in folders with large numbers of assets.

Do you have any rough ETA for this, and is there a beta waitlist I can go on?

IzakJackson commented 1 year ago

+1 for this. Any eta?

Mikilll94 commented 1 year ago

I need this also

max-programming commented 1 year ago

This solution by @halindraprakoso helped me to delete a folder. First, delete all the files and the folder will get deleted https://github.com/orgs/supabase/discussions/4218#discussioncomment-1733111

ffaubert commented 1 year ago

+1 any eta?

ehowey commented 11 months ago

Still need this...

michaelessiet commented 11 months ago

This feature would be much appreciated

ChristopherForrest commented 11 months ago

Please include this feature the workaround for this adds unnecessary complexity to a simple task.

alaincruz06 commented 11 months ago

Watching this and hoping it gets implemented soon

theitaliandev commented 9 months ago

Waiting for this to be implemented...

codingknite commented 9 months ago

Really needed to do this today haha, hoping to see it soon :)

drewhirschi commented 9 months ago

Also +1

martijnvanderpol commented 9 months ago

+1

It would be incredible if this feature could be supported. My current setup involves a folder structure organized by an ID, with subfolders within that main folder related to the ID. Being able to simply remove the parent folder and automatically delete all associated subfolders would be a game changer. As it stands, I have to navigate through several loops to achieve this, which is far from ideal.

madeleineostoja commented 9 months ago

Everyone please stop commenting the equivalent of +1, that’s what votes are for and it clogs up the inbox of everyone subscribed to this issue

PaperPrototype commented 6 months ago

@madeleineostoja how do I vote? Lol, did you thumbs down everyone for saying "+1"?