Hello fellow nerds,
Iam rather new to all this but trying to learn. Ofc Ive googled this but cant find anything that works the way i want. Hopefully I can get some tips and help here.
I have a large number of pdf files in a folder, named like this:
XX1001 - 23.pdf, XX1001 - 27.pdf, XX1002 - 23.pdf, XX1002 - 27.pdf, XX1003 - 23.pdf, XX1003 - 27.pdf and so on..
I want to merge files with simular names into one pdf file, like this: XX1001 - 23.pdf and XX1001 - 27.pdf into XX1001.pdf, XX1002 - 23.pdf and XX1002 - 27.pdf into XX1002.pdf and so on..
Ive tried this one:
rem source root folder where to crawl pdfs.
rem destination folder
for /f "delims=" %%a in ('dir /b /s /ad /o:n "%source%"') do (
for /f "delims=" %%i in ('dir /b /a-d /o:n "%%a\*.pdf"') do (
set _pdffiles=!_pdffiles! "%%i"
echo pdftk.exe !_pdffiles! cat output "%destination%\!_outputpdf:~0,6!.pdf"
It works but i need to have all files in folders with the same name, which i havent got..
How can I modify this for my needs?