# how to make the filenames shorter in length?

**URL:** https://community.mp3tag.de/t/how-to-make-the-filenames-shorter-in-length/13324
**Category:** General Discussion
**Created:** [April 14, 2012, 10:46am UTC](https://community.mp3tag.de/t/how-to-make-the-filenames-shorter-in-length/13324 "2012-04-14T10:46:34Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![evergreen1](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/e/a9adbd/32.png) [@evergreen1](https://community.mp3tag.de/u/evergreen1)
#### Post date: [April 14, 2012, 10:46am UTC](https://community.mp3tag.de/t/how-to-make-the-filenames-shorter-in-length/13324/1 "2012-04-14T10:46:34Z")

</div>

how to make the filenames shorter?

i have long filenames. i want to make the length of the filenames to 25 characters including the spaces between words. how is it possible?

---

<div class="post-metadata">

### Author: ![pone](https://community.mp3tag.de/user_avatar/community.mp3tag.de/pone/32/272_2.png) [@pone](https://community.mp3tag.de/u/pone)
#### Post date: [April 14, 2012, 10:57am UTC](https://community.mp3tag.de/t/how-to-make-the-filenames-shorter-in-length/13324/2 "2012-04-14T10:57:35Z")

</div>

Action: Format Value  
Field: \_FILENAME  
_or_  
Converter: Tag-Filename

Formatstring: $left(%\_filename%,25)

---

<div class="post-metadata">

### Author: ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)
#### Post date: [April 14, 2012, 12:37pm UTC](https://community.mp3tag.de/t/how-to-make-the-filenames-shorter-in-length/13324/3 "2012-04-14T12:37:42Z")

</div>

> [@pone](#):
>
> Action: Format Value  
> Field: \_FILENAME  
> _or_  
> Converter: Tag-Filename
> 
> Formatstring: $left(%\_filename%,25)

Just as an extra option: if you want to make sure that you do not get too many errors that the renaming fails as there is already a file with that (shorter) name, it is ususally a good idea to take care that a number, e.g. the track number does not get trunkated.  
So either you construct a filename that limits the number of characters of all the variables to a certain maximum or you subtract the 4 characters needed for the tracknumber from that length.

---

<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: [April 14, 2012, 12:54pm UTC](https://community.mp3tag.de/t/how-to-make-the-filenames-shorter-in-length/13324/4 "2012-04-14T12:54:31Z")

</div>

> [@ohrenkino](#):
>
> ... if you want to make sure that you do not get too many errors that the renaming fails as there is already a file with that (shorter) name, it is ususally a good idea to take care that a number, e.g. the track number does not get trunkated.  
> So either you construct a filename that limits the number of characters of all the variables to a certain maximum or you subtract the 4 characters needed for the tracknumber from that length.

Do you think about something like this?

**$regexp(%\_filename%,'^(\d+)(.+)$','$1')$left($regexp(%\_filename%,'^(\d+)(.+)$','$2'),22)**

DD.20120414.1652.CEST

---

<div class="post-metadata">

### Author: ![evergreen1](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/e/a9adbd/32.png) [@evergreen1](https://community.mp3tag.de/u/evergreen1)
#### Post date: [April 16, 2012, 10:48pm UTC](https://community.mp3tag.de/t/how-to-make-the-filenames-shorter-in-length/13324/5 "2012-04-16T22:48:25Z")

</div>

> [@DetlevD](#):
>
> Do you think about something like this?
> 
> **$regexp(%\_filename%,'^(\d+)(.+)$','$1')$left($regexp(%\_filename%,'^(\d+)(.+)$','$2'),22)**
> 
> DD.20120414.1652.CEST

can u make it simpler please. what does it mean? i assume this much.  
action\> replace with regular expression  
field\> filename  
regexp\> ?  
replace with\> ?

would u mind explaining it? thanks, have a nice day.

---

<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: [April 16, 2012, 11:52pm UTC](https://community.mp3tag.de/t/how-to-make-the-filenames-shorter-in-length/13324/6 "2012-04-16T23:52:30Z")

</div>

> [@evergreen1](#):
>
> can u make it simpler please. what does it mean? ...

The Mp3tag scripting code line demonstrates a possible implementation of ohrenkino's remark.  
You can fill this code line into the format string edit field of the converter "Tag - Filename".  
See the **preview** result what the code line will do when applying it to the file name.

User ohrenkino has clarified that the shortening of the file name may cause problems, so that "double" file names may arise.  
This problem could be diminished by saving the unique leading track number.  
Shortening should only be applied to the following textual part of the filename.

If you want to try to solve your task as simple as possible, then the function $left() from the basic set of Mp3tag scripting functions might work for you, see post #2 from user pone.

DD.20120417.0400.CEST

---

<div class="post-metadata">

### Author: ![evergreen1](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/e/a9adbd/32.png) [@evergreen1](https://community.mp3tag.de/u/evergreen1)
#### Post date: [April 17, 2012, 9:36pm UTC](https://community.mp3tag.de/t/how-to-make-the-filenames-shorter-in-length/13324/7 "2012-04-17T21:36:09Z")

</div>

> [@ohrenkino](#):
>
> Just as an extra option: if you want to make sure that you do not get too many errors that the renaming fails as there is already a file with that (shorter) name, it is ususally a good idea to take care that a number, e.g. the track number does not get trunkated.  
> So either you construct a filename that limits the number of characters of all the variables to a certain maximum or you subtract the 4 characters needed for the tracknumber from that length.

perfect. it works. thanks a lot. have a nice day

---

<div class="post-metadata">

### Author: ![evergreen1](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/e/a9adbd/32.png) [@evergreen1](https://community.mp3tag.de/u/evergreen1)
#### Post date: [April 17, 2012, 9:39pm UTC](https://community.mp3tag.de/t/how-to-make-the-filenames-shorter-in-length/13324/8 "2012-04-17T21:39:06Z")

</div>

> [@pone](#):
>
> Action: Format Value  
> Field: \_FILENAME  
> _or_  
> Converter: Tag-Filename
> 
> Formatstring: $left(%\_filename%,25)

thanks a lot for the suggestion . it works

---

<div class="post-metadata">

### Author: ![evergreen1](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/e/a9adbd/32.png) [@evergreen1](https://community.mp3tag.de/u/evergreen1)
#### Post date: [April 17, 2012, 9:43pm UTC](https://community.mp3tag.de/t/how-to-make-the-filenames-shorter-in-length/13324/9 "2012-04-17T21:43:27Z")

</div>

> [@DetlevD](#):
>
> The Mp3tag scripting code line demonstrates a possible implementation of ohrenkino's remark.  
> You can fill this code line into the format string edit field of the converter "Tag - Filename".  
> See the **preview** result what the code line will do when applying it to the file name.
> 
> User ohrenkino has clarified that the shortening of the file name may cause problems, so that "double" file names may arise.  
> This problem could be diminished by saving the unique leading track number.  
> Shortening should only be applied to the following textual part of the filename.
> 
> If you want to try to solve your task as simple as possible, then the function $left() from the basic set of Mp3tag scripting functions might work for you, see post #2 from user pone.
> 
> DD.20120417.0400.CEST

thanks for the prmpt reply. it is clear now.

---

<div class="post-metadata">

### Author: ![evergreen1](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/e/a9adbd/32.png) [@evergreen1](https://community.mp3tag.de/u/evergreen1)
#### Post date: [April 17, 2012, 10:27pm UTC](https://community.mp3tag.de/t/how-to-make-the-filenames-shorter-in-length/13324/10 "2012-04-17T22:27:09Z")

</div>

> [@evergreen1](#):
>
> thanks for the prmpt reply. it is clear now.

after typing the above message and piosted it,i wanted to edit my post. i corrected the spelling of prompt and i typed some explanations to DetlevD post. then i clicked full edit. then i saw a blank message box instead of the text. guide me please.
