coreAPI: create new folder after it was deleted if leaveRoot is set to true;
set \0 symbol at actual read position, delete allocated array after read.