I'm trying to find a program/script that can merge files based on the filename. Files are in 1 folder (output from PDF24 print to PDF) and names as the following example:
File name layout:
YYYY-MM-DD HH-MM-SS file name.pdf
2021-05-31 11-12-13 Microsoft Outlook - Memo Style.pdf 2021-05-31 11-12-15 Some another filename - string.pdf 2021-05-31 11-12-18 Some another filename - string.pdf 2021-05-31 11-12-25 Some another filename - string.pdf 2021-05-31 11-12-45 Some another filename - string.pdf 2021-05-31 11-13-21 Microsoft Outlook - Memo Style.pdf
What I want is that the program looks at the filename, and takes every file from 'Microsoft Outlook' (including Outlook) until the next 'Microsoft Outlook' (excluding) and merges them.
What I'm doing is I'm printing an Outlook file and (some of) its attachments, and I want to merge them, so every PDF file is a mail on page 1, and has its attachments on the following pages.
- Important here is that the attachments are in the correct order, ie ordered by date, oldest first
- I want the PDF files to be split by mail. Every PDF file after merging is 1 file and its attachments
- I actually prefer a manual script because it has to run about once a week or once every few days
- Output should be automatically saved to a folder I choose (a subfolder of the source folder)
- I don't really care about output file names. They can be 001, 002, ... for example
I've looked at PDFtk after finding some questions on here, but it either can't do it, or I don't understand the documentation well enough (a very real possibility).
If anyone can help, it would be greatly appreciated.
PS: Merging every single PDF in 1 giant file is something I can do already, but I'd like them split because I can print and staple them automatically that way. Call me... energy efficient. Merging first and splitting afterward could be a possibility too I guess.