#Delete all files

16 messages · Page 1 of 1 (latest)

mossy elk
#

Is there an easy way to clear all files in convex storage? I'm doing 20 at a time and I have 1k total.

pine gobletBOT
#

Thanks for posting in #1088161997662724167.
Reminder: If you have a Convex Pro account, use the Convex Dashboard to file support tickets.

  • Provide context: What are you trying to achieve, what is the end-user interaction, what are you seeing? (full error message, command output, etc.)
  • Use search.convex.dev to search Docs, Stack, and Discord all at once.
  • Additionally, you can post your questions in the Convex Community's #1228095053885476985 channel to receive a response from AI.
  • Avoid tagging staff unless specifically instructed.

Thank you!

mossy elk
#

hmm yeah I think adding a way to get a list of all id's associated with your project to help find orphaned images would be nice

#

because I had a bug in my code that forgot to delete some images

#

but now I have like 1,000 images I have to manually go through and check if they have a corresponding convex entry

#

this is just on dev, but if this was prod and I had real users, idk what I'd even do

#

like a ctx.storage.paginate or something

worn geode
#

Yeah this has come up a few times. We have some ideas but haven't had a chance to prioritize them yet. Thanks for the reminder.

cosmic vector
#

can you do ctx.db.system.query("_storage").paginate(opts) ?

cosmic vector
#

You can also delete all stored files transactionally with a carefully constructed npx convex import, lmk if you want tips on that 🙂

ebon crystal
mossy elk
#
export const listAllFiles = query({
  handler: async (ctx) => {
    // You can use .paginate() as well
    return await ctx.db.system.query("_storage").collect();
  },
});
#

yes, this is perfect

#

sorry for not seeing that 😅