# 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?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

IT / Software Engineering ConsultantCommented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Author Commented:
Thanks Bill, That worked a treat and was exactly what i am after!
0
IT / Software Engineering ConsultantCommented: