There are files in a directory that partly start the same way:
- C001_200129.pdf
- C001_29292.pdf
- C001_ABCDF.pdf
- C041_29292.pdf
- C041_110101.pdf
- P121_AAAA.pdf
- P121_CCCC.pdf
- P121_DDDD.pdf
- P121_AKAKA.pdf
The files with the same prefix (which I do not know beforehand), I only know that the first 4 characters are the same, are to be merged.
pdftk.exe $a*.pdf CAT OUTPUT \Merged\$a-merged.pdf
How do I loop through to find all the files that have the same prefix and then pass them into the $a variable and merge them and then go directly to the next set of files that I can merge.
The goal here should be
- C001_Merged.pdf
- C041_Merged.pdf
- P121_Merged.pdf
to be able to create