# Automate filename cutting for more than 259 chars in an elegant way?

**URL:** https://community.mp3tag.de/t/automate-filename-cutting-for-more-than-259-chars-in-an-elegant-way/13252
**Category:** Support
**Created:** [March 23, 2012, 11:09am UTC](https://community.mp3tag.de/t/automate-filename-cutting-for-more-than-259-chars-in-an-elegant-way/13252 "2012-03-23T11:09:34Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![jettocrack](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/j/e47774/32.png) [@jettocrack](https://community.mp3tag.de/u/jettocrack)
#### Post date: [March 23, 2012, 11:09am UTC](https://community.mp3tag.de/t/automate-filename-cutting-for-more-than-259-chars-in-an-elegant-way/13252/1 "2012-03-23T11:09:34Z")

</div>

Hi guys

As far as I have checked, with W7 64 and most apps there's a length limit for the full path of a file of 259 chars. Due to my folder organization, sometimes I need to "cut" actual filenames, adding something like [...] at the end. Something like:

```
Penderecki - Concerto Grosso No. 1 for 3 Cellos - I - Andan[...].flac

```

Currently Mp3tag allows me to know how many chars my original name is exceeding from the limit, with a custom column like this.

```
$iflonger(%_path%,259,ERROR '('$sub($len(%_path%),259)')',OK '('$sub(259,$len(%_path%))')')

```

I can then manually cut the filename in explorer, which is a bit boring when you have hundreds of files like this, or you change your folder structure and more files need to be cut.

It would be nice to automate the filename cutting, but, since Mp3tag has that limit of 259, it doesn't allow me to modify anything from the path-too-long files, just read. If I move those files to a root folder so they can be modified, then Mp3tag can't know who the bad guys are...Currently I have a method in mind with two stages, but is fairly poor:

1-Export a text file (Mp3tag has no problem in reading long-path files) with the new filenames, whenever they are needed.  
2-Move the whole folders to a root directory, use the previous file to adjust filenames and move back to original folder.

Any ideas of how to modify a filename with a shorter one wihout all that crap? I think that it could be of general interest for Classical Music fans, since long names are common, and quite useful.

My apologies for the extensions, hope I could get some help. Thanks in advance!

---

<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: [March 24, 2012, 9:25am UTC](https://community.mp3tag.de/t/automate-filename-cutting-for-more-than-259-chars-in-an-elegant-way/13252/2 "2012-03-24T09:25:53Z")

</div>

> [@jettocrack](#):
>
> ...but, since Mp3tag has that limit of 259...

I think that this is a limitation of the filesystem and not mp3tag.

Anyway: you could create a user-defined field that has as content the path including the filename.  
Then check if that field is longer than allowed and then apply a cutleft to the that user-defined field and perhaps a little more to add a $num(%track%,2) at the end to get an unambiguous filename.  
Then use the content of the user-defined field as source for the filename.

---

<div class="post-metadata">

### Author: ![LosMintos](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/l/54ee81/32.png) [@LosMintos](https://community.mp3tag.de/u/LosMintos)
#### Post date: [March 26, 2012, 11:47am UTC](https://community.mp3tag.de/t/automate-filename-cutting-for-more-than-259-chars-in-an-elegant-way/13252/3 "2012-03-26T11:47:57Z")

</div>

> [@jettocrack](#):
>
> Any ideas of how to modify a filename with a shorter one wihout all that crap? I think that it could be of general interest for Classical Music fans, since long names are common, and quite useful.

I'm sorry, I can't answer your original question. However, I doubt that these long names are useful, so, if you like, you could explain more detailed why your paths are so long and the community might come up with ideas how to shorten them inherently ;-).

Because of Comments/Tags (and the ability of explorer and the like to read them) it is not necessary to put the whole information redundantly into the path, IMHO.

---

<div class="post-metadata">

### Author: ![djatwork](https://community.mp3tag.de/user_avatar/community.mp3tag.de/djatwork/32/5560_2.png) [@djatwork](https://community.mp3tag.de/u/djatwork)
#### Post date: [July 3, 2012, 7:11pm UTC](https://community.mp3tag.de/t/automate-filename-cutting-for-more-than-259-chars-in-an-elegant-way/13252/4 "2012-07-03T19:11:31Z")

</div>

I too would love a fix for this, and have yet to find a solution ☹

---

<div class="post-metadata">

### Author: ![LyricsLover](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/l/c6cbf5/32.png) [@LyricsLover](https://community.mp3tag.de/u/LyricsLover)
#### Post date: [July 25, 2012, 9:40am UTC](https://community.mp3tag.de/t/automate-filename-cutting-for-more-than-259-chars-in-an-elegant-way/13252/5 "2012-07-25T09:40:32Z")

</div>

Ahh, now I know what you mean. If you create a directory on the root of your drive with the name C:\Test with a extremely long directory name who never ends and I dont know what I could write else in this directory therefore I repeat Test with a extremely long directory name who never ends never ends never ends never ends never ends1234567890 and the 4 subdirectories \A

```
  \B
    \C
      \D I learned, that the longest number for such a directory construction is around 256 (not exactly, because it depends on how you create it and which subdirectory level you try to extend).

```

However:  
You could try something like this:  
FORMAT VALUE  
Field: \_FILENAME  
Format string: $iflonger(%\_folderpath%,232,$left(%\_filename%,24),%\_filename%)  
**FIRST WARNING** : This would cut your existing filename down to 24 characters, if your \_folderpath is longer then 232 character. **You have to adjust this two numbers to your existing structure and needs!**  
**SECOND WARNING** : I don't believe that you get meaningful filenames if you let a computer cut them after a specific number of characters. Possible example:  
OLD: 01 - Here Are Many Wild Animals.mp3  
CUT: 01 - Here.mp3

This is only an example how it would technically work... Be EXTREMELY careful! ![:ph34r:](https://community.mp3tag.de/uploads/default/original/1X/d9d21e0e122fbe04cbaaa509828a996924771538.gif ":ph34r:")

---

<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: [July 25, 2012, 11:42am UTC](https://community.mp3tag.de/t/automate-filename-cutting-for-more-than-259-chars-in-an-elegant-way/13252/6 "2012-07-25T11:42:46Z")

</div>

> [@jettocrack](#):
>
> ... It would be nice to automate the filename cutting ... allow me to modify anything from the path-too-long files ... Any ideas of how to modify a filename with a shorter one ... I think that it could be of general interest ...

The magic is ... "first virtual, then real"

Find there something of interest ...  
[https://community.mp3tag.de/search?q=first+virtual+then+real](https://community.mp3tag.de/search?q=first+virtual+then+real)

DD.20120725.1537.CEST

---

<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: [July 25, 2012, 12:14pm UTC](https://community.mp3tag.de/t/automate-filename-cutting-for-more-than-259-chars-in-an-elegant-way/13252/7 "2012-07-25T12:14:22Z")

</div>

> [@LyricsLover](#):
>
> ... This is only an example how it would technically work... Be EXTREMELY careful! ...

OP can try this elegant way ...

Action: Format value  
Field: \_FILENAME  
Format string: **$regexp(%\_filename%,'[[:space:][:lower:][:punct:]]',)**

... but there is a good chance to get duplicate filenames.

DD.20120725.1614.CEST

---

<div class="post-metadata">

### Author: ![system](https://community.mp3tag.de/uploads/default/original/2X/c/ce7035d426cb755a7916793326d23b465222a407.png) [@system](https://community.mp3tag.de/u/system)
#### Post date: [February 9, 2026, 12:23pm UTC](https://community.mp3tag.de/t/automate-filename-cutting-for-more-than-259-chars-in-an-elegant-way/13252/8 "2026-02-09T12:23:45Z")

</div>


