I’ll tell you how I did it in bash, and maybe you can translate it.
I use pdfunite
(a little more direct than pdftk
) but once you figure out the syntax, it’s easy enough.
for AFILE in `ls 2016*AAA*.pdf` ## For each of the files starting with 2016_AAA do BFILE=`echo $AFILE | sed -e 's/AAA/BBB/'` ## I use stream editor to replace the AAA with BBB and define the ## new file name. You can probably use SUBSTITUTE in Win pdftk $AFILE $BFILE cat output OUTPUT-$AFILE ## This will combine $AFILE and BFILE into OUTPUT-AFILE done
Hopefully this will give you a start.