Node.js script that deletes ALL OF THE files from your Google Drive. Useful if you have thousands or millions of files in your Google Drive and you want to delete them at once. I needed to delete lots of files in my GSuite Google Drive, so I thought doing so with Google Drive API would be a good idea.
- Install Node.js and npm into your computer.
- Install the dependencies by
npm install
. - Go to Google Drive API's Node.js Quickstart and click on "Enable the Drive API" button and follow the instructions.
- When asked, choose "Desktop app" and download the resulting
credentials.json
file to the project root directory.
WARNING: PERFORMING THE NEXT STEP WILL DELETE ALL OF YOUR FILES ON YOUR GOOGLE DRIVE. ⚠⚠
- Run the script by running
node .
in the project root directory. The initial version does not have any confirmation and it will start deleting files right away. PressCtrl + C
orCmd + C
to stop deletion of files at any time.
There's a reason why Google does not provide deleting all files option. Read their response here. I will not be responsible for any files that you accidently delete through the use of this script. You are deleting the files because you don't need them. If you delete any important file by mistake, good luck contacting Google in getting your files recovered.