# Help with smart truncating of long filenames

**URL:** https://community.mp3tag.de/t/help-with-smart-truncating-of-long-filenames/16455
**Category:** Support
**Created:** [December 31, 2014, 1:40pm UTC](https://community.mp3tag.de/t/help-with-smart-truncating-of-long-filenames/16455 "2014-12-31T13:40:25Z")
**Posts on this page:** 1
**Showing post:** 8

<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: [December 31, 2014, 4:20pm UTC](https://community.mp3tag.de/t/help-with-smart-truncating-of-long-filenames/16455/8 "2014-12-31T16:20:13Z")

</div>

**259 characters max. length for a filepathname in a subfolder of a disk.**

For extension '.flac' ...  
254 characters max. length of filepathname without extension.

For extension '.mp3' ...  
255 characters max. length of filepathname without extension.

Action : Format value  
Tag-Field : `_FILENAME`  
Formatstring:

```auto
$ifgreater($len(%_folderpath%$if2(%ALBUMARTIST%,%ARTIST%)[' - '%ALBUM%][' - '$num(%TRACK%,2)]' - '$if2(%TITLE%,'(Untitled)')),$sub(259,1,$len(%_extension%)),$regexp($left(%_folderpath%$if2(%ALBUMARTIST%,%ARTIST%)[' - '%ALBUM%][' - '$num(%TRACK%,2)]' - '$if2(%TITLE%,'(Untitled)'),$sub(259,2,$len(%_extension%))),'\s+$',)'…',%_folderpath%$if2(%ALBUMARTIST%,%ARTIST%)[' - '%ALBUM%][' - '$num(%TRACK%,2)]' - '$if2(%TITLE%,'(Untitled)'))

```

... or written into two steps ...

Action : Format value  
Tag-Field : `TMP_FILENAME`  
Formatstring:

```auto
%_folderpath%$if2(%ALBUMARTIST%,%ARTIST%)[' - '%ALBUM%][' - '$num(%TRACK%,2)]' - '$if2(%TITLE%,'(Untitled)')

```

Action : Format value  
Tag-Field : `_FILENAME`  
Formatstring:

```auto
$ifgreater($len(%TMP_FILENAME%),$sub(259,1,$len(%_extension%)),$regexp($left(%TMP_FILENAME%,$sub(259,2,$len(%_extension%))),'\s+$',)'…',%TMP_FILENAME%)

```

DD.20141231.1828.CET, DD.20150311.1024.CET, DD.20150320.1049.CET

---

_[View the full topic](https://community.mp3tag.de/t/help-with-smart-truncating-of-long-filenames/16455)._
