Created
July 23, 2025 02:40
-
-
Save g-rohit/4643d3adf95309eb909ccf308654173a to your computer and use it in GitHub Desktop.
Get all the folder names from the box.com website
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (()=>{ | |
| // Select all row elements that represent folders by their data attributes or visible content | |
| const folderRows = document.querySelectorAll('div[data-item-index]'); | |
| // Extract folder names from anchor tags within those rows | |
| const folderNames = []; | |
| folderRows.forEach(row => { | |
| // The folder name seems inside: div > div.item-list-name > div.item-name-holder > div.name-row > div.item-name > a.item-link | |
| const anchor = row.querySelector('div.item-list-name div.item-name-holder div.name-row div.item-name a.item-link'); | |
| if (anchor) { | |
| // Optionally check for folder icon or attributes here to distinguish folders from files | |
| // Given this context, all these rows seem to be folders (you can adjust if needed) | |
| folderNames.push(anchor.textContent.trim()); | |
| } | |
| }); | |
| console.log('Folder Names:', folderNames); | |
| })() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment