#!/bin/bash

cd /var/www/photoaman/photoaman/storage/app/public/ai_people || {
    echo "Failed to navigate to directory"
    exit 1
}

# Remove gallery.zip if it exists
rm -f ai_people.zip || {
    echo "ai_people.zip could not be removed. Skipping zip creation."
    exit 0
}

# Create a new gallery.zip and add files to it
ls -lt | head -n 100 | awk '{print $9}' | xargs zip /var/www/photoaman/photoaman/storage/app/public/ai_people.zip


cd /var/www/photoaman/photoaman/storage/app/public/ai_people/thumbnail || {
    echo "Failed to navigate to directory"
    exit 1
}

# Remove gallery.zip if it exists
rm -f ai_people_thumb.zip || {
    echo "ai_people_thumb.zip could not be removed. Skipping zip creation."
    exit 0
}

# Create a new gallery.zip and add files to it
ls -lt | head -n 100 | awk '{print $9}' | xargs zip /var/www/photoaman/photoaman/storage/app/public/ai_people_thumb.zip



cd /var/www/photoaman/photoaman/storage/app/public/people || {
    echo "Failed to navigate to directory"
    exit 1
}

# Remove gallery.zip if it exists
rm -f people.zip || {
    echo "people.zip could not be removed. Skipping zip creation."
    exit 0
}

# Create a new gallery.zip and add files to it
ls -lt | head -n 100 | awk '{print $9}' | xargs zip /var/www/photoaman/photoaman/storage/app/public/people.zip



cd /var/www/photoaman/photoaman/storage/app/public/people/thumbnail || {
    echo "Failed to navigate to directory"
    exit 1
}

# Remove gallery.zip if it exists
rm -f people_thumb.zip || {
    echo "people_thumb.zip could not be removed. Skipping zip creation."
    exit 0
}

# Create a new gallery.zip and add files to it
ls -lt | head -n 100 | awk '{print $9}' | xargs zip /var/www/photoaman/photoaman/storage/app/public/people_thumb.zip



