Skip to content

Instantly share code, notes, and snippets.

@g-rohit
Created July 23, 2025 02:40
Show Gist options
  • Save g-rohit/4643d3adf95309eb909ccf308654173a to your computer and use it in GitHub Desktop.
Save g-rohit/4643d3adf95309eb909ccf308654173a to your computer and use it in GitHub Desktop.
Get all the folder names from the box.com website
(()=>{
// 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