def extend_folder_path(session, selected_list):
    """
    If a folder is part of the original selected list, this function will recursively walk into it to retrieve all
    its files children and add them to the original selected list
    """
    extended_list = []
    for path in selected_list.split(",\t"):
        absolute_path = "/nlmumc/projects/" + path
        # Check if the path is collection
        if session.collections.exists(absolute_path):
            collection = session.collections.get(absolute_path)
            for coll, sub, files in collection.walk():
                for file in files:
                    extended_list.append(file.path.replace("/nlmumc/projects/", ""))
        # Or a file
        else:
            extended_list.append(path)

    return extended_list