Hi.

Assuming the FID was 0xAAAAABBB (including leading zeros), it'll get put in /driveN/fids/_AAAAA/BBB, where N is worked out by the normal method (drive with more space on it).

This seems to be a pretty bad logic, at least if your intention is to evenly distrubute the files across a number of directories.
I will assume a single drive empeg for the following explanation, but this shouldn't actually change the math.
Assume we start with an empty empeg. If we put 16^7 files on it, thus filling your above template to the max, the will be equally distributed across all directories. BUT if we only but 16^2 files on it, only directory /drive0/fids/_00000/ will be created and filled (with 512 files). This would mean that only directories _00000 to _000FF will probably ever be used (65536 tunes/playlists plus corresponding meta files). Is this your intention? Or are you more interested in building an evenly distributed tree? If that was the case, I would probably use either a hash function or turn FID 0xAABBCCDy (with y=0 or y=1) into /driveN/fids/D/CC/AABBCCDy (allowing, but not requiring leading zeroes). This creates a directoy with 16 entries (which are likely to be evenly used): 16 subdirectories with 256 entries each, less likely to be evenly distributed, but this is probably acceptable. Each of those contains about 1/4096 of all files once filled, but never more than 1/16 of all files. Moreover, this structure is pretty easy to populate from the existing flat directory by the following shell script(bash):
for d in 0 1; do

for i in 0 1 2 3 4 5 6 7 8 9 0 A B C D E F; do
cd /drive$d
mkdir $i;
for j in 0 1 2 3 4 5 6 7 8 9 0 A B C D E F; do
for k in 0 1 2 3 4 5 6 7 8 9 0 A B C D E F; do
mkdir $i/$j$k
mv *$j$k$i[01] $i/$j$k/
done
done
done
done
This obviously will only move files with 4 characters or more as a filename, but this is acceptable in my opinion. Besides that, this approach is simple and effective, I would say. If your goal is to create as few directories as possible, all of which are guaranteed not to have more than 512 (or, if
there will ever be fids with [2-9A-F] as last characters: no more than 4096) files in them, obviously your method looks better. I would still keep the full filename though, because it allows the user to move his existing files over to the new location. Well, actually, the above move command could be modified to also rename the file (using some sed, awk and/or perl magic), but why should one make it more complicated than needed?

cu,
sven
_________________________
proud owner of MkII 40GB & MkIIa 60GB both lit by God and HiJacked by Lord