Need to see if your shared folder is taking up space on your dropbox 👨‍💻? Find out how to check here.

Forum Discussion

k s.4's avatar
k s.4
New member | Level 1
11 years ago
Solved

remove all shared links

Hi, I have many links in the links-list. Way to many. I take it that the files linked are accessible for anyone with the link. I want all these links removed with one command. It is too many to do it manually for each one.
Thanks

  • Please be careful as it will delete all your shared links! You have been warned! Works in Chrome (61.0.3163.100) maybe firefox and internet explorer but no links to test =) Open the browser's console window (right click anywhere and select inspect or control+shift+i) while in the shared links page. Paste the following code in the console command line, click enter and it will delete all shared links. 

     

    Due to secure http loading jquery (as suggested by other post) does not work, so this option is fine with vanilla javascript. The script below simulates consecutive mouse clicks: 1. click the three dot button next to the link, 2. click the delete link button in the drop down, 3. click the delete link buttin in the pop up dialog box. Note that it will take a minute to execute all those but in the end the list shall be clear. Hope it save you some trouble... and again be careful

     

    for( var index = 0; index < 1000; index++ )
    {
       var dots = document.getElementById("bubbleDropdownTarget-" + index );
       if( dots == undefined ) continue;
       dots.click( );
       document.getElementsByClassName( "bubble-menu-item" )[0].click( );
       document.getElementsByClassName( "button-primary dbmodal-button" )[0].click( );
    }

46 Replies

Replies have been turned off for this discussion
  • Defender9408's avatar
    Defender9408
    New member | Level 2
    3 years ago

    Hi everyone, there have been several posts with solutions to deleting Dropbox Shared Links (https://www.dropbox.com/share/links) in bulk. The most recent being this post above from August 2022.

     

    ProblemSolved shared above:

     

     

     

    for( let dots of document.getElementsByClassName("mc-button") ) { dots.click( ); for( let del of document.getElementsByClassName("delete-link")) { del.click(); for( let can of document.getElementsByClassName("dbmodal-button") ) { can.click( ); break; } break; } break; }

     

     

     

     

    When I navigate to the Links page, access the console, and initiate the script, I get an undefined error. Is this due to the changes in the page design, or am I doing something wrong? Does anyone have any advice or an updated script that might work?

     

    Thank you for reading!

  • eliransapir's avatar
    eliransapir
    New member | Level 2
    3 years ago

    2023 Dropbox, browse to "shared" page, click "links" submenu, pase the code below into the console: 

    async function pause(ms) {
        return new Promise(resolve => {
            setTimeout(() => {
                resolve();
            }, ms);
        });
    }
    
    async function deleteLinks() {
        const deleteLinkTexts = ["Delete view link", "Delete edit link"]; // Both options
        let items = document.querySelectorAll('.share-page-row-actions [data-testid="open-menu-button"]');
    
        for (let i = 0; i < items.length; i++) {
            items[i].click(); // Click the submenu button to open the menu
            await pause(1000); // Adjust the pause duration as needed
    
            // Find and click the appropriate delete link option
            const deleteLinkOption = Array.from(document.querySelectorAll('.dig-Menu-row-title')).find(item => deleteLinkTexts.includes(item.textContent));
            if (deleteLinkOption) {
                deleteLinkOption.click(); // Click the delete link option
                await pause(1000); // Adjust the pause duration as needed
    
                // Find and click the delete button
                const deleteButton = document.getElementsByClassName("dbmodal-button");
                if (deleteButton.length > 0) {
                    deleteButton[0].click();
                    await pause(1000); // Adjust the pause duration as needed
                }
            }
    
            items = document.querySelectorAll('.share-page-row-actions [data-testid="open-menu-button"]'); // Refresh items
        }
    }
    
    deleteLinks();

     

     

     

     

     

     

  • Defender9408's avatar
    Defender9408
    New member | Level 2
    3 years ago

    eliransapir, thank you so much. This works like a charm!

  • ripknoxx's avatar
    ripknoxx
    New member | Level 2
    3 years ago

    Doesn't work anymore no matter what I try. any other suggestions. 

  • ripknoxx's avatar
    ripknoxx
    New member | Level 2
    3 years ago

    Anyone know a way to delete all links at once. I've already tried the chrome java method and it doesn't work at all. Anyone have any other suggestions. This is confusing as to why they don't have it yet. 

  • AyKuT's avatar
    AyKuT
    Explorer | Level 4
    10 months ago
    async function pause(ms) {
        return new Promise(resolve => {
            setTimeout(() => {
                resolve();
            }, ms);
        });
    }
    
    async function deleteLinks() {
        const deleteLinkTexts = ["Delete view link", "Delete edit link"]; // Both options
        let items = document.querySelectorAll('.share-page-row-actions [data-testid="open-menu-button"]');
    
        for (let i = 0; i < items.length; i++) {
            items[i].click(); // Click the submenu button to open the menu
            await pause(1000); // Adjust the pause duration as needed
    
            // Find and click the appropriate delete link option
            const deleteLinkOption = Array.from(document.querySelectorAll('.dig-Menu-row-title')).find(item => deleteLinkTexts.includes(item.textContent));
            if (deleteLinkOption) {
                deleteLinkOption.click(); // Click the delete link option
                await pause(1000); // Adjust the pause duration as needed
    
                // Find and click the delete button
                const deleteButton = document.getElementsByClassName("button-primary dbmodal-button");
                if (deleteButton.length > 0) {
                    deleteButton[0].click();
                    await pause(1000); // Adjust the pause duration as needed
                }
            }
    
            items = document.querySelectorAll('.share-page-row-actions [data-testid="open-menu-button"]'); // Refresh items
        }
    }
    
    deleteLinks();

    In above script, just changed class name as ''button-primary dbmodal-button'' and it worked for me

About Create, upload, and share

Find help to solve issues with creating, uploading, and sharing files and folders in Dropbox. Get support and advice from the Dropbox Community.

The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.

If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X, Facebook or Instagram.

For more info on available support options for your Dropbox plan, see this article.

If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!