Merge PDFs and name it after all merged PDF names

Post Reply
Chrissigge
Newbie
Posts: 19
Joined: Mon Jun 01, 2015 8:05 am
Location: Switzerland

Merge PDFs and name it after all merged PDF names

Post by Chrissigge »

Hello, I'm stuck with this problem and hope you can help me once again.

I assemble several PDFs and than I want to merge these PDFs to one PDF and
name it after all merged PDF names.

I found the variable [Job.NestedName] and thought I can use this to rename the folder, when I view the Example value
I see all values, but in the end the folder name just contain the name of just one File only.

Does someone have an idea?
loicaigon
Member
Posts: 147
Joined: Wed Jul 10, 2013 10:22 am

Re: Merge PDFs and name it after all merged PDF names

Post by loicaigon »

The rename element should allow you to do this. You can use a separator to merge all nested jobs names.
Once that done the issue you have is that the parent folder name and extensions are included.
But you can nest the rename actiobs in order to filter them out. It seems that when I nest the renaming action in one signle element it fails but splitting into many will work but will extend processing time.

Once that said it's possibly best to use command line or scripting here
Attachments
mergePDFNames.sflow.zip
(20.61 KiB) Downloaded 144 times
freddyp
Advanced member
Posts: 413
Joined: Thu Feb 09, 2012 3:53 pm

Re: Merge PDFs and name it after all merged PDF names

Post by freddyp »

The method with the rename works just fine even with 1 single rename doing multiple actions. Here is how I solved it. After the Assemble job the folder has a name like Job001. In "Rename job" go through the following actions all in 1 single rename:
  • Action Replace - Act on Complete filename - with variable [Job.NestedName:Separator="_",Space="trim"] (this puts an underscore between all parts of the nested name, if you want another character use that one, but you will also have to change it in the actions that follow!!)
  • The first part (Job001) has to go which is the part before the first underscore: Action Search and replace - Filename proper - Search for regular expression [^_]+_ and Replace by nothing Repeat Once
  • Then get rid of all the .pdf_ instances: Action Search and replace - Act on Filename proper - Search for Inline value .pdf_ and Replace by _ Repeat Consecutive
  • The final part to get rid of is the .pdf extension: Action Search and replace - Act on Filename proper - Search for Inline value .pdf and Replace by nothing Repeat Once
The folder now has the intended name proper of the PDF and the "Merge PDF" that follows the rename will add .pdf.
loicaigon
Member
Posts: 147
Joined: Wed Jul 10, 2013 10:22 am

Re: Merge PDFs and name it after all merged PDF names

Post by loicaigon »

Hi Freddy,

I may have misdone something because I couldn't get it to work when I nested the commands in one element.
Will try it over.

Loic
Chrissigge
Newbie
Posts: 19
Joined: Mon Jun 01, 2015 8:05 am
Location: Switzerland

Re: Merge PDFs and name it after all merged PDF names

Post by Chrissigge »

Thank you very much for your help, both solutions are working.
I think it didn't worked for me because I did not use Space="trim" and the filename was too long.
Post Reply