> ... I have about 2 million images ... > folder structure
The "Who's On First" gazetteer with ~ 26M geojson records - using 3-number chunks subfolder structure.
"Given a Who's On First ID its (relative) URI can be derived by splitting the ID in to 3-number chunks representing nested subdirectories, followed by filename consisting of the ID followed by .geojson. For example the ID for Montréal is 101736545 which becomes: 101/736/545/101736545.geojson"
"As of this writing it remains clear that this approach (lots of tiny files parented by lots of nested directories) can be problematic. We may be forced to choose another approach, like fewer subdirectories but nothing has been decided and anything we do will be backwards compatible." ( from https://whosonfirst.org/data/principles/ )