I'm storing files and giving them random numbers as the name, using a 32 bit unsigned range, and writing it as hex. Eg: 087b8a08
.
To avoid having too many files in any one directory I split the name like: 08/7b/8a/08
.
I've noticed that at the top level I have a reasonable number of file names, but each level down that I go there are fewer and fewer files in each directory. (Since I obviously don't store every possible name, just a small subset, eg 10,000, or a 1 million, out of a possible 4 billion.)
What's a good strategy to divide up the hex-digits to have approximately the same number of names at each level, given: an expected number of files that I store, and how many level to divide into?
I read that dividing by e (rounded to 3) each time minimizes the number of items in a level vs the number of levels. But I think that doesn't apply here since I don't use every number name.