# Export long filename truncated

I am seeing a weird behavior on exporting at least one type of file (here, a QuickTime movie) to files with long names. If I do this:

In[19]:= Export["Lorem-ipsum-dolor-sit-amet-consectetur-adipisicing-elit.dat", {42}]
FileNames["Lorem*"]


it hurts:

Out[19]= "Lorem-ipsum-dolor-sit-amet-consectetur-adipisicing-elit.dat"
Out[21]= {"Lorem-ipsum-dolor-s#123C8BE.mov", \


The .dat file has the correct name and the .mov file hasn't, even though Export tries to make me think it has.

My questions are:

• This is not on a MS-DOS box, but with Mathematica 8.0.0.0 on Mac OS 10.7.3 (64-bit kernel). Can you comment if other versions/operating systems reproduce this issue?
• Although I find nothing with Google, is this a known bug and is there a fix?
-
A similar problem occurs exporting a QuickTime movie with a very long name using Apple Final Cut Pro, so it might be related to the creation of a temporary file that is then wrongly renamed. – VLC Apr 5 '12 at 13:14
I tried reproducing the issue on 8.0.4/Windows 7/x64, and couldn't, receiving this message: "Export::installreq: "QuickTime" format is supported only if "QuickTime Player" is installed." That suggests to me that @vucko is correct, and the problem is on Apple's side. – Pillsy Apr 5 '12 at 13:34
Same with me (Win7, 64bit, Mathematica 8.0.4): Export::erropts: The value Cinepak specified for the option VideoEncoding is invalid. >>, and there is no second file appearing at all. – István Zachar Apr 5 '12 at 13:41
With Mathematica 8.0.0.0 on Linux, it complains Export::infer: Cannot infer format of file Lorem-ipsum-dolor-sit-amet-consectetur-adipisicing-elit.mov. and also creates only the .dat. – celtschk Apr 5 '12 at 13:56

The problem is not with Mathematica, but with the quicktime plugin/codec. The reason you see this error is that earlier versions of OSX (version 9 and below) had an upper limit of 31 characters for the filename (27, if you include the extension). Today's systems allow up to 255 characters, but the plugin still forces the filename to be backwards compatible. It is not related to a temporary file not being renamed.

StringLength["Lorem-ipsum-dolor-s#123C8BE.mov"]
Out[1]= 31


Final Cut Pro's manual tells you about this (but leaves the choice of truncating to the user):

Although current file systems such as HFS+ (used by Mac OS X) allow you to create filenames with a 255-character limit, you may want to limit your filename length if you intend to transfer your files to other operating systems. Earlier versions of the Mac OS allow only 31-character filenames, and if you want to include a file extension (such as .fcp, .mov, or .aif), you need to shorten your Mac OS 9-compatible filenames to 27 characters.

Couple of other examples where people have been bitten by this behavior. AFAIK, the workaround is to rename the file after exporting.

-