storage icon indicating copy to clipboard operation
storage copied to clipboard

enable from.remove() to delete folders

Open RyanTippsTX opened this issue 2 years ago • 16 comments

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.

RyanTippsTX avatar Oct 10 '22 20:10 RyanTippsTX

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!

fenos avatar Oct 21 '22 10:10 fenos

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?

madeleineostoja avatar Nov 03 '22 03:11 madeleineostoja

+1 for this. Any eta?

IzakJackson avatar Apr 22 '23 13:04 IzakJackson

I need this also

Mikilll94 avatar Jul 10 '23 10:07 Mikilll94

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

max-programming avatar Jul 28 '23 10:07 max-programming

+1 any eta?

ffaubert avatar Oct 21 '23 23:10 ffaubert

Still need this...

ehowey avatar Nov 21 '23 20:11 ehowey

This feature would be much appreciated

michaelessiet avatar Nov 26 '23 12:11 michaelessiet

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

ChristopherForrest avatar Dec 03 '23 00:12 ChristopherForrest

Watching this and hoping it gets implemented soon

alaincruz06 avatar Dec 10 '23 04:12 alaincruz06

Waiting for this to be implemented...

digiorgiu avatar Jan 18 '24 22:01 digiorgiu

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

codingknite avatar Jan 19 '24 01:01 codingknite

Also +1

drewhirschi avatar Jan 24 '24 19:01 drewhirschi

+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.

martijnvanderpol avatar Feb 07 '24 14:02 martijnvanderpol

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

madeleineostoja avatar Feb 09 '24 23:02 madeleineostoja

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

PaperPrototype avatar Apr 29 '24 02:04 PaperPrototype