GP SoftwareTwitter
Opus FAQsManualCommandsObjects

How to "title" metadata into filename


#1

Hello,

I am trying to add the first 5 numbers listed in the "title" metadata to the filename.

I need to rename thousands of files and numbers in title need to be used in the file name.

If you see the screenshot,
I start from "999.pdf".. and it needs to be
BYL 11491 - 999.pdf

the 11491 is the first 5 numbers from the title metadata.
How can I do this?

Thank you



#2

changes made to title


#3

If you see the screenshot,
I start from "996.pdf".. and it needs to be
BYL 11488 - 996.pdf

the 11488 is the first 5 numbers from the title metadata.
How can I do this?


#4

It should be possible using a rename script.

Is the "BYL" prefix that also needs adding hardcoded, or does that also come from somewhere and need to vary?


#5

The BYL prefix will also start at the beginning of the filename. It will never change. I know how to add that using simple file rename command, i just do not know how to add the numbers from title to the filename...

thank you


#6

any help?


#7

Hi gbadesha,

You can do this now with the Dynamic Renamer:


The idea is simple, and the transformation is:

-$/___{title}/ -/^(.*)___(\d+).*$/BYL $1 - $2/

This is a two stage transformation, which:

  1. adds the title string to the end of the filename, after some unique marker symbols (I chose three underscores).
-$/___{title}/
  1. uses a regular expression to grab the pieces you want, and rearranges the output as per your requirements.
-/^(.*)___(\d+).*$/BYL $1 - $2/

Give it a shot!


#8

PHPBB_IMPORT_WARNING CODE_NEAR_LI

Here's a simple rename script which does the same thing, and does not require you to install Perl (or anything else).

In the Rename dialog:
[ul][li]Set Old Name to *[/li]
[li]Set New Name to *[/li]
[li]Turn on Script Mode[/li]
[li]Paste this as the script:

@script vbscript Function OnGetNewName(ByRef GetNewNameData) TitleWords = Split(GetNewNameData.item.metadata.doc.title, " ") If (UBound(TitleWords) >= 0) Then OnGetNewName = "BYL " & TitleWords(0) & " - " & GetNewNameData.newname End If End Function[/li][/ul]

With the Preview open, click Refresh to test that it works with your real files.

Here's what it should look like:


You can save it as a preset if you will need to use it again in the future, so you don't have to set it up manually again.

Note: I'm assuming Opus 11, so the script uses some things that won't work in earlier versions and allow it to be more concise.


#9

worked like a charm!!

thank you guys