You should ask yourself what is a realistic usable max number of file and go for that and just ignore files beyond that number for example (and issue a warning).
You should ask yourself what is a realistic usable max number of file and go for that and just ignore files beyond that number for example (and issue a warning).