def files_dirs_to_delete(valid_targets, files, empty_dirs):
    """Compare local and remote directory trees looking for files to delete. Combine with empty dirs from get_songs().

    :param iter valid_targets: List of valid target files from get_songs().
    :param iter files: List/dict keys of all files on the FlashAir card.
    :param iter empty_dirs: List of empty directories on the FlashAir card to remove.

    :return: Set of abandoned files to delete and empty directories to remove. One API call deletes either.
    :rtype: set
    """
    delete_files_dirs = set(empty_dirs)
    for path in files:
        if path in valid_targets:
            continue
        if path.lower().endswith('.mp3'):
            delete_files_dirs.add(path)
    return delete_files_dirs