A fully guided beginner-friendly reference for using bulkupload_bash.sh to upload multiple datasets into Borealis Dataverse.
This Bash script does three main actions per dataset folder:
- Ensures each dataset JSON includes a contact email entry (
datasetContactEmail). - Creates a dataset in your Dataverse using dataset metadata (without the
filesblock). - Uploads
files.zipfor that dataset using Dataverse SWORDv2 upload API.
bulkupload_bash.sh: main script that processes dataset folders inDatasets/.Datasets/: each subfolder is one dataset package.
Datasets/
dataset1/
metadata.json # dataset metadata with citation + author + fields, etc.
files.zip # zipped payload of files to attach to dataset
dataset2/
metadata.json
files.zip
dataset3/
metadata.json
files.zip
metadata.jsonis used for dataset creation via API.files.zipis uploaded after dataset creation.
- Linux/MacOS terminal access.
- Bash shell (default on most systems).
- Install
jqandcurl.
Ubuntu/Debian:
sudo apt update
sudo apt install -y jq curlmacOS (Homebrew):
brew install jq curlVerify both are installed with:
jq --version
curl --version- Clone this project:
git clone https://github.com/zbcevik/BulkLoadData_bash.git
cd BulkLoadData_bash- Put your datasets under
Datasets/:
- One folder per dataset (e.g.
Datasets/dataset1/). - Required files in each folder:
metadata.json,files.zip.
- Open
bulkupload_bash.shwith a text editor and set your API info:
API_TOKEN="YOUR_API_TOKEN"
HOSTNAME="https://demo.borealisdata.ca" # or your Borealis host
DATAVERSE_ALIAS="YOUR_DATAVERSE_ALIAS"
DIRECTORY="Datasets" # where dataset folders live
WAIT=0
CONTACT_EMAIL="your.contact@example.com" # used for dataset contact field- Make sure
bulkupload_bash.shis executable:
chmod +x bulkupload_bash.sh./bulkupload_bash.shWhat happens during run:
- Script loops
for datasetDir in "$DIRECTORY"/*. - Calls
add_dataset_contact_emailto add or reusedatasetContactEmailin metadata. - Sends
POST /api/dataverses/$DATAVERSE_ALIAS/datasets/?key=$API_TOKENwith metadata minusdatasetVersion.files. - Reads the response, extracts
DOI. - If DOI exists, uploads
files.zipto/dvn/api/data-deposit/v1.1/swordv2/edit-media/study/$DOI. - Logs status for each dataset and continues next dataset.
-
If upload is successful, you should see output lines like:
Response: ...(API JSON)Extracted DOI: doi:10...Done with Datasets/dataset1
-
Verify on the Dataverse UI using the DOI.
❌ Metadata file not found: confirmmetadata.jsonexists in each dataset folder.❌ No DOI found: dataset creation failed (check API token, hostname, metadata validity).curl: (6) Could not resolve host: wrongHOSTNAMEor network issues.
metadata.jsonmust be valid JSON and have thedatasetVersionblock the script expects.- The script removes
datasetVersion.filesbefore dataset creation to avoid metadata upload conflict.
Original inspiration: https://github.com/kaitlinnewson/dataverse-tools/blob/master/bulkloaddata.sh