add createSubFolders option

And added unit tests for the functionality
Fixes #154