PDFs, merged.
Not just glued together.
File Merger scans a folder, sorts every PDF the way you actually want — including numeric filenames in the right order — and hands the whole stack to Ghostscript for a properly structured single file.
Despite the repo's name, it's PDF-only for now — generic file support is an open idea.
2 comes before 10. Obviously.
Alphabetical sort treats filenames as text — "10.pdf" comes before "2.pdf" because "1" is less than "2". File Merger compares the numbers themselves.
Scroll to watch handout_2 through handout_11 fall into actual numeric order.
Two questions, one file.
Three calls worth explaining.
C++, not Python
A single self-contained executable that other students sharing the same handout folders can run without installing a Python interpreter or any packages.
Ghostscript, not a PDF library
pdfwrite re-renders and recompresses every page into a structurally valid, linearized file. Raw byte concatenation opens fine in most viewers but fails PDF/A checks and can corrupt cross-reference tables — for notes you might need to submit or print, that matters.
std::system(), not linked libgs
Linking Ghostscript's C API complicates the build and ties the binary to one installed version. Shelling out keeps it a single-file compile, at the cost of a slightly slower startup — fine for a batch tool.
Build it, drop it in a folder, run it.
Clone the repository
git clone https://github.com/mirconegri/FileMerger.git
Verify Ghostscript is on PATH
gs --version on Linux/macOS, or gswin64c --version on Windows.
Build it
g++ -std=c++17 PdfMerger.cpp -o FileMergerg++ -std=c++17 PdfMerger.cpp -o FileMerger.execl /std:c++17 PdfMerger.cppRun it
Drop the executable in a folder of PDFs, run ./FileMerger, and answer the two prompts.
Built in the open, one folder of scans at a time.
Look at the code, suggest generic (non-PDF) support, or open an issue.