Delete all photos from google photos Permanently – Google photos Delete Tool

0
775

Google photos tend to get cluttered very quickly and honestly it needs work on sorting the unnecessary photos. But what can you do to delete all the photos from google photos library? Well, the Hacking world has a solution for you. Introducing the google photos tool, a delete script that can automatically delete all photos stored in google photos and help you save the space. You can delete google photos permanently and that too without any hassle.

Do note the photos deleted cannot be restored. There is always that one guy who forgets to read the disclaimer. Make sure it isn’t you. This script will permanently delete your photos from google photos. You have been warned.

Credit for the script goes to Mr. Rishab Manocha.

Prerequisites:

So without further ado lets begin:

Step 1: Log in to your google account

Step 2: Go to Google Photos

Step 3: Now since you are logged in you will see the photos that you want to delete

Step 4: Now you need to open developer options in chrome

Open Developer Tools. You can do so by typing the following keys

  • Keyboard ShortcutPressing the three keys together in the sequence – CTRL + SHIFT + I

Step 5: After opening the developer console click on the console tab as shown in the image below:

Click on the Console tab.

delete photos automatically with google photos delete tool

Note: The purpose of the console is it lets you run custom code, like this tool we are using to remove photos! You can learn about it on the Google Console page.

Step 6: Copy all the code in the file delete_photos.js and paste it in the console. For simplicity, I have copied the code for you.

The code credits belong to Rishab and his google photos delete tool. Thanks for the help

Script Code:

// How many photos to delete?
// Put a number value, like this
// const maxImageCount = 5896
const maxImageCount = "ALL_PHOTOS";

// Selector for Images and buttons
const ELEMENT_SELECTORS = {
    checkboxClass: '.ckGgle',
    deleteButton: 'button[title="Delete"]',
    confirmationButton: '#yDmH0d > div.llhEMd.iWO5td > div > div.g3VIld.V639qd.bvQPzd.oEOLpc.Up8vH.J9Nfi.A9Uzve.iWO5td > div.XfpsVe.J9fJmf > button.VfPpkd-LgbsSe.VfPpkd-LgbsSe-OWXEXe-k8QpJ.nCP5yc.kHssdc.HvOprf'
}

// Time Configuration (in milliseconds)
const TIME_CONFIG = {
    delete_cycle: 7000,
    press_button_delay: 1000
};

const MAX_RETRIES = 10;

let imageCount = 0;

let checkboxes;
let buttons = {
    deleteButton: null,
    confirmationButton: null
}

let deleteTask = setInterval(() => {
    let attemptCount = 1;

    do {
        checkboxes = document.querySelectorAll(ELEMENT_SELECTORS['checkboxClass']);

    } while (checkboxes.length <= 0 && attemptCount++ < MAX_RETRIES);


    if (checkboxes.length <= 0) {
        console.log("[INFO] No more images to delete.");
        clearInterval(deleteTask);
        console.log("[SUCCESS] Tool exited.");
        return;
    }

    imageCount += checkboxes.length;

    checkboxes.forEach((checkbox) => { checkbox.click() });
    console.log("[INFO] Deleting", checkboxes.length, "images");

    setTimeout(() => {

        buttons.deleteButton = document.querySelector(ELEMENT_SELECTORS['deleteButton']);
        buttons.deleteButton.click();

        setTimeout(() => {
            buttons.confirmation_button = document.querySelector(ELEMENT_SELECTORS['confirmationButton']);
            buttons.confirmation_button.click();

            console.log(`[INFO] ${imageCount}/${maxImageCount} Deleted`);
            if (maxImageCount !== "ALL_PHOTOS" && imageCount >= parseInt(maxImageCount)) {
                console.log(`${imageCount} photos deleted as requested`);
                clearInterval(deleteTask);
                console.log("[SUCCESS] Tool exited.");
                return;
            }

        }, TIME_CONFIG['press_button_delay']);
    }, TIME_CONFIG['press_button_delay']);
}, TIME_CONFIG['delete_cycle']);

 

Now copy and paste the above code and Hit ENTER button. The script will start running upon hitting ENTER key and your images will start to get autodeleted. Do note it takes some time for the process to start and all photos are not deleted at once. It basically automates the process of selecting all images and deleting them. So have patience.

  • delete google photos with google photos delete tool

Once all images are deleted you can close the tab and reopen photos to check if any images are left. I have personally used this tool and it works flawlessly.

If you have questions then let me know in the comment section below. We would be happy to help.

Related articles: How to recover your google account from hackers

How to recover deleted images from android.

 

I hope this guide helped you use the google photos delete tool to delete photos permanently. If you know any more ways to delete photos from google app then let me know in the comment section below. Have a great day

LEAVE A REPLY

Please enter your comment!
Please enter your name here