Preamble: 'Unbooking' a PDF has been asked before. That said, I haven't found an answer to this specific part of the process. Thanks to extensive research and a lot of help from this site, I'm halfway there. Full explanation of what I'm doing and links to resources at the end of this question.
Primary Question: (focus on this and ignore the rest, if you want)
I have, out of one "booked" PDF, managed to create 2 PDF files. One is the left side, and one is the right side of the original PDF. The left side's pages are in this order: 16, 2, 14, 4, 12, 6, 10, 8 and the right side's pages are in this order: 1, 15, 3, 13, 5, 11, 7, 9.
I want to achieve normal single-page order (1, 2, 3, 4, 5... 16) in a single output file using any combination of Batch, Ghostscript, or PDFtk.
Using either PDFtk or GhostScript and likely some form of a batch for loop, I need to:
- (maybe) Identify the total number of pages there are to work with(?)
- Loop through them and compile an output file out of two documents in the correct order
Further Question Detail & Testing Resources:
A similar/partial solution may be found here, however, I do not know python well enough to interpret what is happening or test it.
Test_PageNumbers.pdf - Here's a link to an example "booked" PDF, what I'm starting with
IMPORTANT NOTE -- The above is added for clarity. Splitting the above PDF is outside of the scope of this question and has been answered before. See bottom section of this question for details on that.
left-sections.pdf - Here's just the truncated left side to test with
right-sections.pdf - Here's just the truncated right side to test with
DesiredOutput.pdf - Here's what the desired output would look like
Here's a table of what the correct order looks like:

What I've Already Done
This script combines the PDFs, but all out of order.
pdftk ^
A=right-sections.pdf ^
B=left-sections.pdf ^
shuffle A B ^
output single-pages-output.pdf
This script tells me the number of pages (outputs: NumberOfPages: 8) but I've had a terrible time isolating just the number using pure Batch script to use in a for loop, which is my preferred method so I can run this on multiple machines without an additional library install.
SET d=test
pdftk left-sections.pdf dump_data | findstr NumberOfPages>pgs
set /p d= < pgs
echo %d%
This was my attempt at isolating the number. It doesn't work yet. I don't know if this step is necessary. There may be another creative solution, perhaps with a while loop, looking at errorlevel?
for %%f in ("%d:\=" "%") do for /f %%n in ('echo %%f^|findstr /b /e /r "\"[0-9]*\""') do (
echo %%~n
)
This script (based on: How can I split a PDF's pages down the middle? and Convert PDF 2 sides per page to 1 side per page and How to set custom page size with Ghostscript) splits the "booked" PDF into two sides. THIS IS BEYOND THE SCOPE OF THE QUESTION, BUT ADDED FOR CONTINUITY AND CLARITY OF WHAT I'M DOING
::Left Sections
gswin32c.exe ^
-o left-sections.pdf ^
-sDEVICE=pdfwrite ^
-g5040x6120 ^
-c "<</PageOffset [0 0]>> setpagedevice" ^
-f Test_PageNumbers.pdf -q
::Right Sections
gswin32c.exe ^
-o right-sections.pdf ^
-sDEVICE=pdfwrite ^
-g5040x6120 ^
-c "<</PageOffset [-504 0]>> setpagedevice" ^
-f Test_PageNumbers.pdf -q
Final Note
Once I have this final piece, I am good enough (I think) to compile one Batch program that processes a file and outputs a final PDF. I'm NOT(!) asking for an entire batch program from start to finish. This question is ONLY addressing the reordering of pages into one combined PDF where the pages are in order.
Thank you!