Grok.com - Delete files in storage

 #coding

Here's some JS to loop through and delete all files in your Grok.com file storage. Theres no option to "delete all" files on Grok.com, like there is for conversations - and deleting all conversations does not delete files.

So, you can run this in the console of your browser, or alternatively create a bookmarklet in your browser with the code.

If you have a large amount of files, you may want to increase the timeout value to something higher to avoid being rate limited. As it is though, 600ms worked for me with over 100 files.

(async () => {
    while (document.querySelector('button[aria-label="Delete file"]')?.click()) {
        try {
            await new Promise(r => setTimeout(r, 600));
            document.querySelector('button[aria-label="Delete"]')?.click();
            await new Promise(r => setTimeout(r, 600));
        } catch (e) {
            console.error(`Error: ${e.message}`);
        }
    }
})();