#!/bin/bash

# Starting directory (default to current directory if none provided)
START_DIR="${1:-.}"

echo "Starting permission fix in: $START_DIR"

# Change permissions for directories to 775
find "$START_DIR" -type d -exec chmod 775 {} \;
echo "Changed permissions on directories to 775"

# Change permissions for files to 664
find "$START_DIR" -type f -exec chmod 664 {} \;
echo "Changed permissions on files to 664"

# Optional: Change ownership to plex:plex (uncomment if needed)
# find "$START_DIR" -exec chown plex:plex {} \;
# echo "Changed ownership to plex:plex"

echo "Done."
