Skip to main content
Sometimes an application might want to upload all files from a folder. To do so with the SDKs and the CLI requires traversing the folder tree, finding every file and uploading it accordingly.

Breakdown

The scripts above use the Box SDKs and the CLI to upload an entire folder. For the SDK scripts, they start by creating a directory in Box to match the local folder. After the new directory is created, it uploads all files within the directory making sure to use all available Box features to make the uploads successful. Using the API the files are checked for conflicts and size restrictions before they are uploaded. If a naming conflict is found, the script instead uploads a new version of that file. Using the the SHA hash of the file the scripts add a content-md5 header on upload to make sure the file is successfully uploaded to Box without any bytes lost or tampered with. Finally, if a file size exceeds 20MB`, the script uses the feature to make sure uploads are more reliable for larger files.
Last modified on March 19, 2026