Skip to content

Instantly share code, notes, and snippets.

@justinTM
justinTM / DownloadBoxFilesPython.py
Created April 16, 2020 00:45
Using Python (`boxsdk`, `requests`, and `tqdm` modules), all files from a Box folder -- specified by ID -- are downloaded via URL. Yes the binary can simply be downloaded with the Box SDK methods.
from boxsdk import DevelopmentClient
import requests
from tqdm.auto import trange
client = DevelopmentClient()
user = client.user().get()
folder = client.folder(folder_id='XXXXXXXXXXXX')
files = [item for item in folder.get_items()]
@justinTM
justinTM / GetSubfolderNames.js
Created December 14, 2017 09:09
Collecting a list of subfolder names using Google Apps Script - a try-catch "hack" for increasing execution time
function GetSubfolderNames(rootFolderID) {
var rootFolder = DriveApp.getFolderById(rootFolderID);
var subfolders = rootFolder.getFolders();
var subfolderName;
var subfolderNames = [];
for (var i=0; ; i++) {
try {subfolderName = subfolders.next().getName();}
catch(e){
if (e == "Exception: Cannot retrieve the next object: iterator has reached the end.")