Automating the re-naming of some pdf files

Sorry I don’t have my Mac now, but for remove pages from pdf you can use JXA and Apple PDFKit.
See here:

If you will not find resolution I can look into that tomorrow evening (CEST time).

BTW
Do you know Hazel? it is good in manipulating files in automatic way.

https://www.noodlesoft.com/