getfolderstructure function

Extracts folderstructure based on data directory.