Separate loops searching for dataset directory and for creating the directory