def group_files_by_folder_path()

in ees_network_drive/utils.py [0:0]


def group_files_by_folder_path(file_details):
    """This method returns a dictionary of folder paths and list of files inside the folder
    :param file_details: dictionary containing file id and file path
    Returns:
        file_structure: dictionary containing folder and list of files inside the folder
    """
    file_structure = {}
    if file_details:
        for file_id, file_path in file_details.items():
            file_path, file_name = os.path.split(file_path)
            if file_structure.get(file_path):
                file_structure[file_path][file_name] = file_id
            else:
                file_structure[file_path] = {file_name: file_id}
    return file_structure