Home

Batch-Uploading a Large Document Collection to the Internet Archive

August 24, 2026

Mission

You have a large folder of individual documents — PDFs, text files, whatever — and you want each one to become its own item on the Internet Archive, without typing out an ia upload command by hand for every single file. This walks through doing that safely and repeatably using ia’s built-in spreadsheet feature.

Step 1: Validate your files first

Before uploading anything, check that your PDFs aren’t corrupted. A broken file mid-batch can cause an upload to fail partway through, so it’s worth catching problems early:

brew install qpdf
find /path/to/your/documents -name "*.pdf" -exec qpdf --check {} \; 2>&1 | grep -B1 error

Repair anything flagged as a real error before moving on. (Opening a corrupted PDF in Preview and printing it to a new PDF is often enough to fix it.)

Step 2: Generate a metadata spreadsheet

Rather than writing a separate ia upload command for every file, ia supports a CSV spreadsheet where each row describes one file and its destination item. A small script can build this automatically by scanning your folder:

#!/bin/bash

SOURCE_DIR="/path/to/your/documents"
OUTPUT_CSV="upload_metadata.csv"
IDENTIFIER_PREFIX="myproject_"

echo "identifier,file,title,mediatype,collection,creator,language" > "$OUTPUT_CSV"

for filepath in "$SOURCE_DIR"/*; do
  filename=$(basename "$filepath")
  name_no_ext="${filename%.*}"

  clean_id=$(echo "$name_no_ext" \
    | tr '[:upper:]' '[:lower:]' \
    | sed 's/[^a-z0-9]/_/g' \
    | sed 's/_\+/_/g' \
    | sed 's/^_//;s/_$//')

  identifier="${IDENTIFIER_PREFIX}${clean_id}"
  title="$name_no_ext"

  echo "\"$identifier\",\"$filepath\",\"$title\",texts,opensource,,eng" >> "$OUTPUT_CSV"
done

echo "Wrote $(($(wc -l < "$OUTPUT_CSV") - 1)) entries to $OUTPUT_CSV"

Run it:

chmod +x generate_upload_csv.sh
./generate_upload_csv.sh

This produces upload_metadata.csv — one row per file, each with an auto-generated identifier and title.

Step 3: Review the spreadsheet

Open the CSV in Excel, Numbers, or Google Sheets before uploading anything. This is your chance to:

Step 4: Run the batch upload

ia upload --spreadsheet=upload_metadata.csv --checksum --retries=120 --sleep=120

Step 5: Test small before going big

Before running this against thousands of files, try it on a handful first (5–10 rows). Confirm the resulting items look right — correct title, correct file, correct identifier — before committing to the full collection.

Step 6: Watch for interruptions

As with any large batch, a single failed upload can cut off processing partway through. Redirect output to a log file so you can review it afterward instead of relying on scrollback:

ia upload --spreadsheet=upload_metadata.csv --checksum --retries=120 --sleep=120 2>&1 | tee upload_log.txt
grep "error uploading" upload_log.txt

That’s it — a repeatable way to turn a folder of individual documents into a properly cataloged set of items on the Internet Archive, without hand-writing a command for each one.