There should be a folder rule, which helps us to limit number of files in folder.
We should have a warning limit and a hard stop limit with proper error code/mesages when someone tries to add content to the folder if the said folder rule is set.
As per some documentations its supposed to be only few thoussand files at most in a folder. Lets say if we want to limit it to 5000 max in a folder, we should be able to give that number in the rule with a warning limit of 4000. Above 4000, all API should start giving warning and once it hits 5000, it should give error and no more files should be allowed to be added in that folder.