Skip to content

Instantly share code, notes, and snippets.

@ZettZet
ZettZet / onedrive-trash-cleanup.js
Created September 27, 2024 19:09
Deleting files from OneDrive is difficult, especially if you want to delete thousands at once. The settings delete button does not work, and you can delete only 50 files at once.
setInterval(() => {
Array.from(document.querySelectorAll('[aria-labelledby]'))
.slice(0, 50)
.forEach((item) => {
const id = item.getAttribute('aria-labelledby')
document.getElementById(id).click()
})
document.querySelector('button[data-automationid="deleteCommand"]').click()
waitForElm('button[data-automationid="confirmbutton"]').then((element) => element.click())
}, 100)