On my system, fewer than 1/4 of the files in /drive0/fids/ begin with '1', but most of the files in /drive1/fids/ do (drive1 was added quite recently, so it's not huge).

I'm still confused by the mathematics of this.

Suppose the fids directory contains all FIDs up to n digits, and all the (n+1) digit FIDs that begin with 1. Then we have 16^n that begin with 1, and 16^n others, of which 1/15 begin with 1. So 17/30 begin with 1 - only just more than half. If we now increase the number of FIDs, the new ones all begin with 2, so the proportion that begin with 1 decreases, until we fully populate all the (n+1) digit FIDs, at which point all initial numbers are equally distributed 1/15 each.

Perhaps you have lots of 1* FIDs as a result of deleting old (short FID) stuff?

In case it's not clear, I'm not accusing you of being wrong to add this code; I just want to understand the logic of it a bit better. Maybe we could do even better by comparing the last-but-one character (which is most likely to be uniformly distributed 16 ways)? After first checking length>1, of course... Hmm perhaps re-implement a variant memcmp that starts at the end, inside ext2_match()?
_________________________
Toby Speight
030103016 (80GB Mk2a, blue)
030102806 (0GB Mk2a, blue)