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
Craig HunterAsked:
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.

Bill PrewIT / 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"
)

Open in new window


»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.

Start your 7-day free trial
Craig HunterAuthor Commented:
Thanks Bill, That worked a treat and was exactly what i am after!
0
Bill PrewIT / Software Engineering ConsultantCommented:
Great, glad that was helpful.


»bp
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PDF

From novice to tech pro — start learning today.