import csv
import zipfile
import os


def write_csv(arr,folder):
    with open(folder+'/failed_png.csv', 'w', newline='') as csvfile:
        # Create a CSV writer object
        writer = csv.writer(csvfile)
        
        # Write header row if needed
        writer.writerow(['Produkt', 'Name', 'Grund'])
        
        for row in arr:    
            writer.writerow([row[0], row[1],  row[2]])
            


def zip_folder(folder_path, zip_path):
    with zipfile.ZipFile(zip_path, 'w', zipfile.ZIP_DEFLATED) as zip_file:
        for root, dirs, files in os.walk(folder_path):
            for file in files:
                zip_file.write(os.path.join(root, file))