# Rename file only if extension matches (.Mp3, .Flac, etc)

**URL:** https://community.mp3tag.de/t/rename-file-only-if-extension-matches-mp3-flac-etc/13499
**Category:** Support
**Created:** [May 31, 2012, 6:35am UTC](https://community.mp3tag.de/t/rename-file-only-if-extension-matches-mp3-flac-etc/13499 "2012-05-31T06:35:54Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![DetlevD](https://community.mp3tag.de/user_avatar/community.mp3tag.de/detlevd/32/123_2.png) [@DetlevD](https://community.mp3tag.de/u/DetlevD)
#### Post date: [May 31, 2012, 8:19am UTC](https://community.mp3tag.de/t/rename-file-only-if-extension-matches-mp3-flac-etc/13499/2 "2012-05-31T08:19:09Z")

</div>

> [@LaurenBacall](#):
>
> I am in the process of setting up an Action for renaming recorded podcasts. Each podcast has two files: one lossless (FLAC) and one lossy (MP3). I wish to rename the FLAC files differently than the MP3 files ... for the FLAC files I wanted to append the string '[original]' after the RegEx.  
> Eg:  
> MP3:  
> 2012.05.31.mp3  
> FLAC:  
> 2012.05.31 [original].flac

You did not show the specific Regular Expression, you did talk about, so I assume there is no RegExp involved, but only basic Mp3tag scripting features.

If you want to apply an action to append some data to an existing tag-field content, then the following proposals may help.

1. Set Filter  
"%\_extension%" IS "FLAC"

2. Use Action  
Action: Format value  
Field: \_FILENAME  
Formatstring: **%\_filename%' [original]'**

... or ...

1. Use Action  
Action: Format value  
Field: \_FILENAME  
Formatstring: **$if($eql($lower(%\_extension%),'flac'),%\_filename%' [original]',%\_filename%)**  
Because %\_extension% returns always lower cased names this should work too ...  
Formatstring: **$if($eql(%\_extension%,'flac'),%\_filename%' [original]',%\_filename%)**

See also:  
[Actions](https://community.mp3tag.de/t/967/5)

DD.20120531.1218.CEST

---

_[View the full topic](https://community.mp3tag.de/t/rename-file-only-if-extension-matches-mp3-flac-etc/13499)._
