Combine every 4 pdf


Please, help me with a script.
There is a folder with 800x4 pdf-files named:

I need a script:

  1. get folder content
  2. cycle every 4 files
  3. combine them
  4. save with name “idX.pdf” (use id from initial file, first)

It looks not very difficult, but it will take long time for a beginner. Thank you in advance

Here is a workflow I quickly created that should get you started:

This workflow does:

  1. Prompt you for a folder containing pdfs
  2. Only combines every 4th pdf
  3. Moves the combined pdf to the same folder containing the original pdfs
  4. Renames the combined pdf to “output.pdf”

This workflow does not:

  1. Delete the outputted pdf file at the beginning of workflow. So if you run it a second time you will get weird results. Since running a second time you will have an odd number of pdf’s in the folder. An easy solution would be store the outputted file on the desktop.

  2. Does not rename the file like you want.

Thank you. Final result: