I have a situation that I need to merge files again by file names. Now, I have files in one folder like this -
A1.pdf, A2.pdf, B1.pdf, C1.pdf, C2.pdf, C3.pdf.
The goal is to merge files by file names and I will get A.pdf, B.pdf, C.pdf. I tried different things in the batch file, but none worked so far. Can you please help?
The real files names are like this below.
115_11W0755_70258130_841618403_01.PDF 115_12W0332_70258122_202990692_01.PDF 115_12W0332_70258122_202990692_02.PDF 115_12W0332_70258122_202990692_03.PDF 115_14W0491_70258174_562605608_01.PDF 115_14W0491_70258174_562605608_02.PDF 115_14W0776_70258143_680477806_01.PDF 115_16W0061_70258083_942231888_01.PDF 115_16W0065_70258176_202990692_01.PDF 115_16W0065_70258176_202990692_02.PDF
the 3rd part (70258083) is the element that works as uinque per batch. In other words, I want to merge files per this element. from the file names listed above, there will be 6 PDF files.
I am using the batch script below to merge two files into one. I don't know how to tweak this to more than 2 files to merge OR leave a single file alone.
Please help.
setlocal enabledelayedexpansion for %%# in (115_*.pdf) do ( set n=%%~n# set n=!n:~,-30!
pdftk A=!n!.pdf B=%%# cat B A output C:\IN\_fileNames\Merge\Files\!n!.pdf
)
here is the error screen