Skip to content

Instantly share code, notes, and snippets.

@danielo515
Created November 14, 2020 14:10
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danielo515/81d5fb2d5cb6498402902c7c4020be6e to your computer and use it in GitHub Desktop.
Save danielo515/81d5fb2d5cb6498402902c7c4020be6e to your computer and use it in GitHub Desktop.
Restore everything on google drive bin
const recoverAll = (kind,iterator) => {
while (iterator.hasNext()) {
const next = iterator.next();
next.setTrashed(false);
Logger.log(kind + ": " + next.getName() + " RESTORED!");
}
}
function RecoverTrash() {
const folders = DriveApp.getTrashedFolders();
recoverAll("Folders", folders)
Logger.log("All folders restores, going to restore individual files")
const files = DriveApp.getTrashedFiles();
recoverAll("Files", files)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment