updating to get base folder name from directory structure