I am trying to split pfs using PDFTK. I am trying to create a batch file that will split multiple PDF's in a folder and output all pages into a directory even if the pdf only has one page

I am trying to split pfs using PDFTK. I am trying to create a batch file that will split multiple PDF's in a folder and output all pages into a directory even if the pdf only has one page.
Is that possible ? and if so how ?
script that i have is:

pdftk c:\test\test2\*.pdf burst output c:\test\test3\page-%%02d.pdf
Who is Participating?

Commented:
Give this a try. It will process all the *.PDF files in the folder specified in the BaseDir variable, and bursts the pages into the folder specified in the DestDir directory.  It is assumed these both exist...

The burts files will have the same base filname as the original PDF, with the page_xx added to that, for example:

TestFile.pdf will generate output files TestFile_page-01.pdf and TestFile_page-01.pdf if it is two pages long.

@echo off
setlocal

set BaseDir=B:\EE\EE29084971\in
set DestDir=B:\EE\EE29084971\out

for %%A in ("%BaseDir%\*.pdf") do (
pdftk "%%~A" burst output "%DestDir%\%%~nA_page-%%02d.pdf"
)


»bp
0

Author Commented:
Thanks Bill, That worked a treat and was exactly what i am after!
0

Commented:

»bp
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.