# How to "title" metadata into filename

**URL:** <https://resource.dopus.com/t/how-to-title-metadata-into-filename/20707>\
**Category:** Help & Support\
**Created:** [June 8, 2015, 6:25pm UTC](https://resource.dopus.com/t/how-to-title-metadata-into-filename/20707 "2015-06-08T18:25:04Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![gbadesha](https://resource.dopus.com/user_avatar/resource.dopus.com/gbadesha/32/26172_2.png) [@gbadesha](https://resource.dopus.com/u/gbadesha)\
**Post date:** [June 8, 2015, 6:25pm UTC](https://resource.dopus.com/t/how-to-title-metadata-into-filename/20707/1 "2015-06-08T18:25:04Z")

</div>

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

![](https://resource.dopus.com/uploads/default/original/3X/5/f/5fd2c7e339736507e2907d4023eba4d19e92a9cb.jpg)

---

<div class="post-metadata">

**Author:** ![gbadesha](https://resource.dopus.com/user_avatar/resource.dopus.com/gbadesha/32/26172_2.png) [@gbadesha](https://resource.dopus.com/u/gbadesha)\
**Post date:** [June 8, 2015, 6:26pm UTC](https://resource.dopus.com/t/how-to-title-metadata-into-filename/20707/2 "2015-06-08T18:26:12Z")

</div>

changes made to title

---

<div class="post-metadata">

**Author:** ![gbadesha](https://resource.dopus.com/user_avatar/resource.dopus.com/gbadesha/32/26172_2.png) [@gbadesha](https://resource.dopus.com/u/gbadesha)\
**Post date:** [June 8, 2015, 6:28pm UTC](https://resource.dopus.com/t/how-to-title-metadata-into-filename/20707/3 "2015-06-08T18:28:04Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Leo](https://resource.dopus.com/user_avatar/resource.dopus.com/leo/32/69732_2.png) [@Leo](https://resource.dopus.com/u/Leo)\
**Post date:** [June 8, 2015, 6:32pm UTC](https://resource.dopus.com/t/how-to-title-metadata-into-filename/20707/4 "2015-06-08T18:32:13Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![gbadesha](https://resource.dopus.com/user_avatar/resource.dopus.com/gbadesha/32/26172_2.png) [@gbadesha](https://resource.dopus.com/u/gbadesha)\
**Post date:** [June 8, 2015, 6:42pm UTC](https://resource.dopus.com/t/how-to-title-metadata-into-filename/20707/5 "2015-06-08T18:42:33Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![gbadesha](https://resource.dopus.com/user_avatar/resource.dopus.com/gbadesha/32/26172_2.png) [@gbadesha](https://resource.dopus.com/u/gbadesha)\
**Post date:** [June 9, 2015, 9:21pm UTC](https://resource.dopus.com/t/how-to-title-metadata-into-filename/20707/6 "2015-06-09T21:21:54Z")

</div>

any help?

---

<div class="post-metadata">

**Author:** ![MrC](https://resource.dopus.com/letter_avatar_proxy/v4/letter/m/43a26b/32.png) [@MrC](https://resource.dopus.com/u/MrC)\
**Post date:** [June 10, 2015, 12:48am UTC](https://resource.dopus.com/t/how-to-title-metadata-into-filename/20707/7 "2015-06-10T00:48:09Z")

</div>

Hi gbadesha,

You can do this now with the [Dynamic Renamer](https://resource.dopus.com/t/dynamic-renamer/14993/1):

 ![](https://resource.dopus.com/uploads/default/original/3X/8/b/8bcb0e42e77193baaf7f0284aea9fa6fcf0c8119.png)  

The idea is simple, and the transformation is:

```auto
-$/___{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).

```auto
-$/___{title}/
```

1. uses a regular expression to grab the pieces you want, and rearranges the output as per your requirements.

```auto
-/^(.*)___(\d+).*$/BYL $1 - $2/
```

Give it a shot!

---

<div class="post-metadata">

**Author:** ![Leo](https://resource.dopus.com/user_avatar/resource.dopus.com/leo/32/69732_2.png) [@Leo](https://resource.dopus.com/u/Leo)\
**Post date:** [June 10, 2015, 7:58am UTC](https://resource.dopus.com/t/how-to-title-metadata-into-filename/20707/8 "2015-06-10T07:58:36Z")

</div>

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:

 ![](https://resource.dopus.com/uploads/default/original/2X/e/eeba1b9ac652e5deee1bb5fc78cdf1322391106d.png)  

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.

---

<div class="post-metadata">

**Author:** ![gbadesha](https://resource.dopus.com/user_avatar/resource.dopus.com/gbadesha/32/26172_2.png) [@gbadesha](https://resource.dopus.com/u/gbadesha)\
**Post date:** [June 12, 2015, 8:45pm UTC](https://resource.dopus.com/t/how-to-title-metadata-into-filename/20707/9 "2015-06-12T20:45:09Z")

</div>

worked like a charm!!

thank you guys
