Take a look at DBTest::FilesPerLevel()