rhberro
rhberro2y ago

Batch deleting files from file storage via dashboard nor script

Is there a way to delete multiples files at once via dashboard or even via script? Recently I've uploaded about 600 files and just deleted the data that used to contain the reference to these files, using the dashboard's interface I could only find a way to delete file by file, its gonna take some time this way.
5 Replies
nipunn
nipunn2y ago
You can write a convex function that does it and run it from the function runner (or npx convex run) Though this sounds like a good feature request for the dashboard interface! oh! I suppose there is not a way to list out your storage IDs from a script. Also a good feature idea!
Michal Srb
Michal Srb2y ago
Hey @rhberro , probably the best you can do atm is to copy the storage IDs from the dashboard page, then use them in a mutation that deletes them all. Definitely a missing feature for us.
james
james2y ago
If it’s any consolation for now we’re not actually charging for storage currently. Bulk delete is a known gap and we can add this feature before enabling any charging Sorry for the inconvenience!
nipunn
nipunn2y ago
I whipped together this (hacky) workaround to get a list of storage IDs. Hopefully this works in the meantime to unblock you until we solve this properly. 1) Go to your dashboard page. 2) Open the console - do $$("tr div.truncate").map((d) => d.innerHTML) Then you can use that list of storage IDs in a convex function to delete files (https://docs.convex.dev/file-storage/delete-files) - which you can run from the dashboard function runner or npx convex run
Deleting Files | Convex Developer Hub
Files stored in Convex can be deleted from
rhberro
rhberroOP2y ago
Hey @nipunn thats a nice workaround! Didn't try it out yet but seems to work fine.

Did you find this page helpful?