folder structure generation with limit of 40 files per folder