Aaaaaahnd Again...
- 3 minutes read - 489 wordsSo I’ve managed to blog several times about how there’s a limit to the root folder on a FAT volume. And you remember how I said I’d got around the problem by creating a subfolder? Well, that didn’t quite do what I wanted. Or, indeed, work in any way, shape or form. Arse.
The situation is that our car will read MP3 files off a keydrive inserted in the USB hole. This worked fine when I filled up a 128 MB keydrive, because I could dump them all in the root folder on that keydrive. But that wasn’t big enough, so I decided to use my 2 GB key drive. However, it didn’t seem to like the files being in a folder. So, back to the drawing board.
The limit is 512 directory entries. I’d created a playlist limited to just under 2 GB in iTunes. This came out as 471 files, easily under the 512 limit. Except that, as the Microsoft article explains, the long file name support can use anything up to four directory entries per file, if it has a long name. So, to rename the files. Obviously, you use Automator to do this. I created an application that automatically renames the files from the original names to something like “MP3-xxxx.mp3”. Job done — 471 files, 471 directory entries. Result!
Or is it? About 160 files through copying, it all went splat again. But why this time? I’d forgotten another trick the Mac has up it’s sleeves — extended attributes. Like NTFS (the file system that Windows since Windows 2000 prefers to use), the Mac HFS+ file system likes to store metadata inside the data files. This is how the Mac knows what to do with files. Both NTFS and HFS+ support multiple streams in a file. But, when you copy a file from HFS+ to FAT16, which does not support these multiple streams, what happens? Well, the Mac creates two files, one for the data and one for the metadata1. The metadata files have the same name as a data file, but with “._” on the front, to make them invisible.
It was these files that had blown up my copy. Each metadata file was not just one directory entry, but two, because they’re long file names! So my copy quit out. What to do?
Well, turns out that there’s a way to tell the Mac to not create the metadata files. But you have to use Terminal. Here’s how:
cp -XvR <src> <dest>This will copy one folder to another, but the X stops the system creating the
metadata files on the destination. Hey presto, 471 files in the root folder of
my keydrive.
Now to see if the car will play it.
Strictly speaking, on HFS+ these are called the data fork and the resource fork. On NTFS, they are known as streams, and you can have more than two of them. ↩︎