# 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:** 1

<div class="post-metadata">

### Author: ![LaurenBacall](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/l/35a633/32.png) [@LaurenBacall](https://community.mp3tag.de/u/LaurenBacall)
#### Post date: [December 31, 2014, 1:40pm UTC](https://community.mp3tag.de/t/help-with-smart-truncating-of-long-filenames/16455/1 "2014-12-31T13:40:25Z")

</div>

I've noticed with my regular filename Action that occasionally the full Windows path + filename output will be too long and return an error within Mp3Tag.

For example here's one such path that would be too long for Windows, that I ended up truncating manually with an ellipsis:

_M:\Music\CDs\Soundtracks\Studio Ghibli\Hayao Miyazaki & Joe Hisaishi Soundtrack Box Set\Ponyo on the Cliff by the Sea (Original Soundtrack)\Joe Hisaishi - Ponyo on the Cliff by the Sea (Original Soundtrack) - 36 - Ponyo on the Cliff by the Sea (Film Version).flac_

The common method of truncating is _$left(%\_filename%,n)_ however this doesn't take into account the filepath, only the filename. Windows reduces the maximum allowed length of filenames based on the full path not just the filename, eg: moved to the Desktop the above file doesn't require truncation as the directory path is shorter.

Is there a way to truncate filenames to a certain number of characters taking into account the full file path + filename? ohrenkino also [made the point](https://community.mp3tag.de/t/13324/3) that blindly truncating could lead to duplicates in some cases if the tracknumber gets cut, is there a way to include this prevention as well?

Any help and pointers would be appreciated.

---

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