Hi
I have pdf´s that I need to rename at output. Actually I just need to remove a segment within the name.
Usually the files are named with this syntax:
S60_15w46_V1_DEde.pdf
But there can be variations in the first segment:
XC60_15w46_V1_DEde.pdf
V60CC_15w46_V1_DEde.pdf
(There can alos be variations in the digits and country code, but not in length)
And I need to remove the ”_V1_” from the filename. And replace it with just a ”_". Or just remove "V1_".
I know how to match the whole name with regular expressions.
([A-Za-z0-9]*)_([0-9][0-9])w([0-9][0-9])_V([0-9])_([A-Z][A-Z])([a-z][a-z])\.(pdf|PDF)
And the first segment:
([A-Za-z0-9]*)_([0-9][0-9])w([0-9][0-9])
V60CC_15w46_V1_DEde.pdf
And also the last segment:
(([A-Z][A-Z])([a-z][a-z])\.(pdf|PDF))
XC60_15w46_V1_DEde.pdf
But I can not figure out how to use the two segments in the output name.
Any suggestions?
Thanks.
Rename PDF with regular expressions
Re: Rename PDF with regular expressions
If you can script, you can easily get the values of your regular expression like this: http://forum.enfocus.com/viewtopic.php? ... .cap#p4096
Again, if you can use scripter, the easiest way is to write your new name into private data then pass it into a rename configurator.
Again, if you can use scripter, the easiest way is to write your new name into private data then pass it into a rename configurator.
Chat: open-automation @ gitter
Code: open-automation & dominickp @ GitHub
Tools: Switch, Pitstop, EPMS, Veracore, PageDNA, SmartStream, Metrix
Code: open-automation & dominickp @ GitHub
Tools: Switch, Pitstop, EPMS, Veracore, PageDNA, SmartStream, Metrix
Re: Rename PDF with regular expressions
Hi
Thanks for your reply, and that looks like a nice solution.
But I don't have the script module.
/P
Thanks for your reply, and that looks like a nice solution.
But I don't have the script module.
/P
Re: Rename PDF with regular expressions
Hi again.
I found a solution after some heavy googling and some testing.
I used the Rename Job configurator and a two action step in properties where I select the two parts I needed.
Action 1 renames and action 2 adds a prefix by selecting last part then first part with regex.
Cheers
/Pär
I found a solution after some heavy googling and some testing.
I used the Rename Job configurator and a two action step in properties where I select the two parts I needed.
Action 1 renames and action 2 adds a prefix by selecting last part then first part with regex.
Cheers
/Pär
Re: Rename PDF with regular expressions
If what you are removing is always "_V1_" you could just use the "search and replace" in the rename configurator. Search for "_V1_" and replace with "_".
Re: Rename PDF with regular expressions
That would work. But I forgot to mention that the number in "_V1_" also varies.
Re: Rename PDF with regular expressions
I think you could still use Search and Replace.
Search for: _V([0-9])_ (as regular expression)
Replace with: _ (Inline value)
Search for: _V([0-9])_ (as regular expression)
Replace with: _ (Inline value)
Re: Rename PDF with regular expressions
Yes, that works perfectly now.
I think I was trying to do just that when I started to solve this problem.
But I wasn't really familiar with the rename configurator. Now I am...
Thanks.
I think I was trying to do just that when I started to solve this problem.
But I wasn't really familiar with the rename configurator. Now I am...
Thanks.