Batch-Convert a Folder of PDFs to Flipbooks

Batch convert PDF to flipbook from a whole folder with one shell loop using the FlipLink CLI — capture URLs to CSV and skip bad files.

Sumit Ghugharwal
Sumit Ghugharwal

Published on June 21, 2026 · 6 min read

Share this post:

You have a folder. Fifty product PDFs sitting in it. Each one needs to become a flipbook with a sensible title, and you need the share links in a spreadsheet by end of day. Doing that by hand — upload, name, wait, copy the link, paste it, repeat — is the kind of task that eats an afternoon and your patience.

This guide shows you how to batch convert PDF to flipbook for an entire folder with a single shell loop, collect every resulting URL into a CSV, and keep going even if one file is broken. It assumes you already have the FlipLink CLI installed and authenticated. If not, start with Getting Started with the FlipLink CLI first — it takes about two minutes.

The Building Block: One File at a Time

Before looping over fifty files, get one file right. The CLI command that turns a PDF into a flipbook is:

fliplink flipbook create ./deck.pdf --title "Q3 Report" --name q3

--title is what readers see; --name is the internal label. Add --json and the command prints the raw API response instead of a friendly summary — that JSON is what we'll mine for the share link later:

fliplink flipbook create ./deck.pdf --title "Q3 Report" --json

That single response carries everything you need: the new flipbook's ID and its public URL. Now we just need to run it once per file.

The Loop: Convert Every PDF in a Folder

Here's the core of it. Drop your PDFs into a folder, cd into it, and run a bash loop over *.pdf. We derive a clean title from each filename — strip the .pdf extension and swap dashes/underscores for spaces:

#!/usr/bin/env bash
for f in *.pdf; do
  # Turn "spring-product-catalog.pdf" into "spring product catalog"
  name="$(basename "$f" .pdf | tr '_-' '  ')"
  echo "Converting: $f  ->  \"$name\""
  fliplink flipbook create "$f" --title "$name" --json
done

This walks the folder, converts each PDF, and prints the JSON result for every one. It works, but the output is a wall of JSON and a single bad file would still let the rest run. Let's fix both — first the output, then the error handling.

Collecting the Results to a CSV

What you actually want at the end is a spreadsheet: one row per flipbook, with its ID and share link. Pipe each --json result through jq to pull out just those two fields and append a CSV row.

The create response contains the flipbook's ID and a URL. We extract both, fall back to a placeholder if a field is missing, and write a header row once at the top:

#!/usr/bin/env bash
out="flipbooks.csv"
echo "file,id,url" > "$out"           # write the CSV header once

for f in *.pdf; do
  name="$(basename "$f" .pdf | tr '_-' '  ')"
  echo "Converting: $f"

  json="$(fliplink flipbook create "$f" --title "$name" --json)"

  # Pull ID + URL from the JSON; '// "?"' supplies a fallback if absent
  row="$(printf '%s' "$json" | jq -r '[.ID, .URL] | @csv' 2>/dev/null)"

  printf '%s,%s\n' "$f" "$row" >> "$out"
done

echo "Done. Results in $out"

jq -r '[.ID, .URL] | @csv' builds a properly quoted CSV fragment from the two fields, and @csv handles any commas or quotes inside the values for you. Open flipbooks.csv in any spreadsheet and you've got your distribution list.

If you'd rather grab the canonical share link separately, the CLI has a dedicated command for that — fliplink flipbook share-link <flipbookId> — which you can call with the ID you just captured.

🚀

Try FlipLink Free

Convert your PDF in seconds. No sign-up, no credit card — just upload and go.

Drop your PDF here or click to browse

Max 40MB

Paid plans from $39 raise this to 150 MB.

Don't Let One Bad File Kill the Batch

Folders are messy. One PDF might be corrupt, oversized, or push you past your plan quota. The default loop would happily report the failure as a row and move on — but you won't know which ones actually succeeded.

The CLI gives you a clean signal through its exit codes:

  • 0 — success
  • 1 — a request or HTTP error (network, oversized upload, auth)
  • 2 — an application error (the API returned Result: ERROR, e.g. quota exceeded)

Check the exit code after each call. Log the winners to your CSV, the failures to a separate list, and keep the batch running either way:

#!/usr/bin/env bash
out="flipbooks.csv"
fail="failed.txt"
echo "file,id,url" > "$out"
: > "$fail"                            # truncate the failure log

ok=0; bad=0
for f in *.pdf; do
  name="$(basename "$f" .pdf | tr '_-' '  ')"
  echo "Converting: $f"

  if json="$(fliplink flipbook create "$f" --title "$name" --json)"; then
    row="$(printf '%s' "$json" | jq -r '[.ID, .URL] | @csv' 2>/dev/null)"
    printf '%s,%s\n' "$f" "$row" >> "$out"
    ok=$((ok + 1))
  else
    code=$?                            # 1 = request error, 2 = application error
    echo "$f (exit $code)" >> "$fail"
    bad=$((bad + 1))
  fi
done

echo "Converted $ok, failed $bad. See $out and $fail."

Because the CLI exits non-zero on failure, the if branch only runs on a genuine success, so your CSV never fills up with empty rows. At the end you get a count and a failed.txt listing exactly which files to investigate — re-run just those once you've fixed them.

A Note on Folder Assignment

A common follow-up question: “Can the loop drop everything into a specific FlipLink folder?” There is no --folder flag on fliplink flipbook create — don't reach for one, it doesn't exist.

A couple of things to know about how FlipLink folders work: they're created on demand and disappear again when they're empty, so there's nothing to pre-create. To put a flipbook into a folder, use the CLI's escape hatch — the api command — which can reach any endpoint, including ones without a dedicated subcommand:

fliplink api PUT /api/assign-to-folder/<flipbookId> --data '{"Folder":"Marketing/Q2"}'

Slot that call into the success branch of the loop, passing the ID you captured from the create response. If you're unsure about the exact field names for any endpoint, check the live API reference rather than guessing — every parameter is documented there with a Try-It console.

Wrapping Up

A folder of PDFs, one shell loop, and a CSV of share links waiting at the end — that's the whole job. The same pattern scales from five files to five hundred, and the exit-code check means a single bad file never derails the run. For more on FlipLink's scripted workflows, the CLI documentation covers every command, and Bulk Operations explains how this fits a larger publishing pipeline — perfect for keeping product catalogs up to date in batches.

Ready to Create Your First Flipbook?

Transform your PDFs into interactive flipbooks and documents. Get started with FlipLink's Lifetime Deal — lifetime access that starts at just $39.

#cli#batch#automation#pdf#bulk operations
Lifetime Deal

Pay Once, Use Forever

10, 50 or 100 flipbooks · All 35 features · Unlimited domains

$39
10 Flipbooks
$89
50 Flipbooks
Most Popular
$129
100 Flipbooks

No feature gates. Every Lifetime Deal tier unlocks all 35 features.

  • Every feature unlocked — no feature gates
  • Stackable — buy more codes anytime
  • Replaceable — swap old for new
  • Unlimited custom domains (CNAME)
  • No recurring fees, ever

Related Reading

Tutorials5 min read

Getting Started with the FlipLink CLI

Install the FlipLink CLI, authenticate, and turn a PDF into a published, shareable flipbook from your terminal in a few commands.

Sumit Ghugharwal