You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

📰 Newsroom Update

Billie Eilish is Apple Music’s Artist of the Year for 2024. Learn more >

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Why does iTunes for Windows truncate filenames?

I am thinking about using iTunes as a music manager for my Windows setup. I run Windows 7 (64-bit). When I load iTunes with my music one of the defects I notice with iTunes is that it oddly truncates the filenames of the songs I load into it.


The song filenames seem to be truncated after 30 or so characters. Why does iTunes do this, especially when all the supported versions of Windows can support much longer filenames?

AppleTV 2, Mac OS X (10.6.7)

Posted on Sep 12, 2011 11:35 AM

Reply
14 replies

Sep 12, 2011 2:01 PM in response to camper

If you let iTunes "Keep the iTunes Media folder organized" it will use folder and file names with a maximum of 40 characters, inclusive of the extension characters. The following characters are replaced with an underscore. \ / : * ? " < > | and also ; (which is a valid filename character). A leading space or period is also replaced, as is a trailing period for a folder name. Trailing spaces are stripped.


Windows has a 255 character limit for filenames. That said is it still sometimes possible to bury files deeper than that by accident, for example if higher level folders are renamed. This can cause problems accessing the files.


I don't know why iTunes for Windows imposes the 40 character limit, but if you don't have the "Keep organized" option set you can put things where you want before you import them to iTunes and they will stay as you left them. I used to manually tweak, remove and reimport stuff but these days I have a custom script that renames files according to my rules (different character substitutions, longer paths, certain genre specific folders etc.) and then automatically reconnects iTunes to the files.


tt2

Sep 13, 2011 8:02 AM in response to turingtest2

The forced 40 character filename truncation seems rather arbitrary to me. It is performed whether or not the truncation is actually necessary.


For example... here is the pathname for one of my files before iTunes "fixes" it:


T:\iTunesTempMedia\music\Pink Floyd (Screaming Abdabs)\The Committee And Other Stories\V - Pink Floyd (Screaming Abdabs) - The Committee And Other Stories, side 1.aif


Its about 166 characters and one of the longest, if not the longest, pathnames I have in iTunes.




Now, here is how iTunes mangles the filename:


T:\iTunesTempMedia\music\Pink Floyd (Screaming Abdabs)\The Committee And Other Stories\V - Pink Floyd (Screaming Abdabs) - .aif



That's about 127 characters in length.





So it is obvious that iTunes truncated the filename even though the truncation of the filename was not necessary. If iTunes truncated the filename only when it is really necessary, I would not have a issue with that. However, it is the completely arbitrary nature of the truncation that I dislike.

Sep 13, 2011 12:36 PM in response to camper

As I said I don't know why iTFW limits segments of the path to 40 characters, however the rule is applied consistently to all parts of the path that iTunes is managing. I started out with an iRiver H140 which took forever to start up in full database mode so I used the file system to access my media. This meant that truncated or mangled text affected how easily I could select what I wanted to listen to. Back in the day I would fix my file structure with Magic File Renamer, remove any broken links from iTunes and reimport. Eventually I got in to scripting which is much more powerful and convenient. It also provides a good way to waste time which could otherwise be spent just enjoying the music. I strongly advise you not to care what your library looks like within the filing system but concentrate on making it perform for you within the application. If you read my article on Grouping tracks into albums you'll see there is the potential for quite enough obsessive organization there before you start worrying about the files themselves. If it really bothers you then download my ConsolidateByMoving script and change the line that reads Std=True to Std=False. This will give you longer filenames and better character substitutions, for example a double quote becomes two single quotes instead of an underscore.


You could also drop a line to iTunes Feedback but I'm guessing they've probably had plenty on this topic over the years and haven't felt the need to change it yet.


tt2

Sep 14, 2011 11:52 AM in response to turingtest2

> As I said I don't know why iTFW limits segments of the path to 40 characters,


I really did not ask you a second time why it was the filename is arbitrarily truncated.




Thanks for the pointers for your scripts, however, they do not fix the iTunes problem of arbitrarily truncating the filenames.


I have dropped a line to the blackhole known as iTunes feedback. Quite a while ago. In return, I've received no reply, or even the courtesy of an acknowledgement from Apple.


Sometimes I wonder if it is worth supporting a vendor who places such an impenetrable wall between itself and its users.

Sep 14, 2011 12:28 PM in response to camper

I suppose the point I'm trying to make is that the program works as it is designed to. From that point of view there is no problem to solve. Like many applications it can't work exactly the way every user would like it to. While there is no harm in letting Apple know that you'd like it changed, don't expect them to change just for you.


Their feedback pages promise that your submission will be read, but explicity state that you won't get a reply. You've not been singled out to be ignored, that's just the way it works. If they employed people to respond individually to every item of feedback or ran in-house tech support instead of this user support area everything they make or sell would have to cost even more than it does now.


Having made your submission the options are to live with the software as it works now, find a workaround, or use something else. Use something else doesn't really cut it for me with an iPhone, iPad and some older iPods in the family and, try as I might, I can't live with what I consider to be poor organisation, so I've built my own workarounds. Feel free to use and adapt them for your needs if you wish.


tt2

Sep 15, 2011 11:03 AM in response to turingtest2

> I suppose the point I'm trying to make is that the program works as it is designed to.


And the point I am trying to make is that I doubt if the corruption of user data was a design goal for iTunes.


Yes, corruption of user data. I use carefully constructed filenames, and iTunes is unnecessarily mangling those filenames. I have shown that the filename corruption occurs on files that are well within the Windows limit for fully-specified filenames.


There is no reason for iTunes to corrupt those filenames.

Sep 15, 2011 11:30 AM in response to camper

If the names are "carefully constructed" then why are you letting iTunes manage them at all? I don't. Simply go to Edit > Preferences > Advanced and uncheck Keep iTunes Media folder organised, then redo the import of your library from your original source folders with the full length filenames. Copy these into the iTunes Media folder the way you want them organised and then add them to the library.


tt2

Sep 16, 2011 9:16 AM in response to turingtest2

> If the names are "carefully constructed" then why are you letting iTunes manage them at all?


That's throwing out the baby with the bath water. If iTunes didn't have the filenaming bug, there wouldn't be a problem.


The Keep iTunes Media Folder Organized option explicitly states how it organizes the files within the media folder.


iTunes is not doing what it says, as it is corrupting the filename. iTunes is not using the disc number, track number and song title to name the file. iTunes is arbitrarily and unnecessarily truncating the filename.


I consider the unnecessary truncation of the filename to be corruption of user data, as such it is a bug.

Oct 7, 2011 2:39 PM in response to camper

FWIW, I have iTunes running on a PC, which does truncate the file names, and also iTunes running on an iMac, which doesn't. Go figure?


I have spent forever getting my media folder organised, repairing links etc., so not too chuffed that iTunes now wants to arbitrarily truncate file names. Looks like I will have to transfer all my files (500Gb) to the Mac, as I wanted to convert them all from WAV to Apple Lossless, then copy to my NAS - this would seem to be the only way to preserve the integrity of the file names.


NB, I don't allow iTunes to organise the media folder, but it still buggers about with the file names when I create a Lossless copy.


Might look to see what other tools exist to create Lossless copies.

Jul 25, 2015 5:22 AM in response to sskrishna

The Windows file system imposes a 260 character path length limit. For reasons known only to Apple they have imposed a 40 character limit on each segment of the path that the application constructs, the artist and album folders, and the filename including the file extension. All characters that are invalid in filenames are replaced with underscores. As long as the path to the media folder is shorter than about 130 characters (to allow for \Music\ and other separators in the path) then iTunes won't exceed the permitted path length. OS X doesn't have the same path length limitation which presumably explains the different strategy.


A proportional font may give the wrong impression as to which string is longer than another. An extreme example is shown here:

iiiiiiiiii (10 charcters)

wwwww (5 characters)


In general it really doesn't matter where the media files are stored as long as each application you use is able to find them when you want them. That said I too prefer to see as much information as possible in the file paths. I use a custom version of my script ConsolidateByMovingLong which will preserve all of the detail if possible, has nicer character substitutions and, in my case, also moves certain genres such as comedy, classical and soundtracks into their own folders.


tt2

Why does iTunes for Windows truncate filenames?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.