Most people assume batch PDF work means paid suites or drag-and-drop wizards. The truth is kinder: two free command-line tools cover nearly every folder-level PDF job, and once you save your first script, repeating it takes seconds.
If you need this as one file, our free organize pdf tool runs entirely in your browser — nothing is uploaded.
This post is for total beginners who have never opened a terminal. It explains what the tools do, where to download them on Windows and Mac, and gives three copy-paste recipes that solve the most common bulk tasks. No programming background needed.
qpdf handles PDF-level operations: splitting, joining, encrypting, removing passwords, linearizing, and compressing streams. It is text-based, scriptable, and free. It works on files, not on the visual appearance of the document.
ImageMagick converts files between image formats and can read/write PDF. It is the go-to tool for turning PDFs into images and vice versa. It is free and available on every major platform.
Together these two tools let you rename, compress, and convert entire folders without opening a single document.
Open Terminal (Applications > Utilities > Terminal) and install Homebrew: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Then:
Both are free and open source. No licenses, no trial timers.
Suppose you have a folder of scans named “scan001.pdf”, “scan002.pdf”, etc., and you want to rename them to their file modification date plus a sequence number.
mkdir /tmp/renamed
i=1
for f in *.pdf; do
d=$(date -r "$f" +%Y%m%d)
mv "$f" "/tmp/renamed/${d}_${i}_pdf"
i=$((i+1))
done
On Windows (Git Bash), the same loop works; date -r may need GNU coreutils. On Mac it works out of the box.
qpdf can rewrite a file with stream compression. This does not change the appearance but reduces file size for text and vector PDFs.
mkdir compressed
for f in *.pdf; do
out="compressed/${f%.pdf}_lite.pdf"
qpdf --compress-flate=1 --object-streams=generate "$f" "$out"
echo "$f -> $out"
done
If a file is already tiny, qpdf will just copy it. You can add a size check later if you need a hard cap, but for most folders this one loop gets 80% of the benefit.
ImageMagick can render PDFs to PNGs. This is useful for previews, uploads, or OCR.
mkdir images
for f in *.pdf; do
base="${f%.pdf}"
convert -density 150 "$f" "images/${base}_%03d.png"
done
Each page becomes its own PNG file. Lower density for smaller files; raise it for sharper text.
A terminal log is just a sequence of messages. Three things to watch:
Save your session by redirecting: append “2>&1 | tee run.log” to any command. Now you have a file to grep later.
Keep each recipe in its own .sh file (or .bat if you prefer Windows cmd). Suggested layout:
~/pdf-scripts/
rename_by_date.sh
compress_all.sh
pdfs_to_images.sh
Make them executable once: chmod +x ~/pdf-scripts/*.sh. To rerun: cd /path/to/folder && ~/pdf-scripts/compress_all.sh. The script can live anywhere; just cd into the folder containing the PDFs first so the *.pdf glob works.
Do I need to install anything besides qpdf and ImageMagick? No. Both are free. On Mac, Homebrew is the only extra step and it is also free.
Will qpdf compress every PDF? It rewrites streams, so text and vector PDFs shrink. Scanned-image PDFs barely change; for those, ImageMagick plus re-export is the better path.
Can I do this on a USB stick or external drive? Yes. Just cd into the folder first. Permissions matter: you need read on the PDFs and write on the destination.
What if my filenames have spaces? The for f in *.pdf loop and the quoted "$f" in the recipes above already handle spaces. Do not use unquoted $f.
Do these scripts run headless, i.e. without a monitor? Yes. They are pure CLI. Run them over SSH, from a cron job, or a scheduled task with no problem.
---
That is the full beginner loop: two tools, three recipes, logs you can read, and scripts that live in one folder you can rerun forever. If your next project is folder-level PDF compression with a hard size cap, the related post /blog/batch-compress-folder-of-pdfs-under-size-limit/ goes deeper. For naming conventions, see /blog/batch-rename-pdfs/; for a single-file deep dive, read /blog/compress-pdf-without-uploading/.