def add_folder_sizes(c):
    """Aggregate folder size from file sizes and set folder value."""
    sql = """
        SELECT SUM(size) as size, parent_folder
        FROM files
        GROUP BY parent_folder
    """
    c.execute(sql)
    sizes = c.fetchall()
    sql = """
        UPDATE folders
        SET folder_size = ?
        WHERE folder_id = ?
    """
    c.executemany(sql, sizes)
