The Haiku/BeOS Tip Server
Tips and tricks for Haiku/BeOS users

DOS filenames messed up with ~1

Contributed by: Cyan
This tip is valid for: Both BeOS and Haiku

BeOS is not known for its DOS FAT filesystem handling; this is for several reasons — known problems include:

  • BeOS does not update the modified date when you modify a file on a FAT partition. Note: a workaround for this problem is to use the commandline “touch” command to update the file’s date. There is a tracker add-on on BeBits which does this from the GUI.
  • BeOS has been known to set the modified dates to unexpected things when creating files from scratch on FAT.
  • Manipulating files causes the “creation date” to be lost (to be fair, creation date is a Windows add-on to FAT, so it’s not terribly standard).
  • BeOS isn’t aware of the creation date, and will not display it; instead displaying the modified date
  • BeOS also isn’t aware of DOS attribute bits like Archive, and destroys those like the creation dates

And, the problem which this tip focuses on:

  • BeOS does not handle long filename termination properly.

In Windows, Linux, or another OS which handles FAT long filenames, all filenames consisting of 8 characters or less have the DOS name set to the same name as you type. For filenames longer than 8 characters, the DOS filename becomes the first 6 characters of the long name, plus a “~1” on the end. In case that file also exists, the number increments to ~2, and so on.

By this mechanism, most files you create in these operating systems should be accessible in DOS just fine, and the names should be clear and understandable if you’ve kept the names to 8 characters or less.

However, in BeOS R5, things are a little different. Instead of passing all filenames less than 8 characters through to DOS without adjustment, BeOS blindly adds the ~1 and terminates to 6 characters, regardless of your filename length. The only thing which persuades BeOS to do it properly is to type your filename entirely in upper case, which is both ugly and counter-intuitive.

Note: you will not see this effect from inside your other OS (Windows, Linux, etc); only from DOS, where the short filenames are always displayed.

Downloading the “FAT filesystem (modified)” addon from BeBits will cure this problem, by making BeOS handle long filenames in DOS like everything else, without having to use CAPS, regardless of whether or not your FAT partitions mount slowly.

Posted in Miscellaneous


(comments are closed).