Combine every 4 pdf

Hello

Please, help me with a script.
There is a folder with 800x4 pdf-files named:
id1_page1.pdf
id1_page2.pdf
id1_page3.pdf
id1_page4.pdf
id2_page1.pdf
id2_page2.pdf
id2_page3.pdf
id2_page4.pdf

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: https://dl.dropboxusercontent.com/u/1426164/misc/combine.workflow.zip

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: https://yadi.sk/d/WqHTKQLLa3Jbv