#!/bin/bash
# gen_urls.sh
if [ -z "$1" ]; then
  echo "Usage: $0 <directory_path>"
  exit 1
fi
DIR="$1"
if [ ! -d "$DIR" ]; then
  echo "Error: The provided path '$DIR' is not a valid directory."
  exit 1
fi
find "$DIR" -maxdepth 1 -type f -print0 | while IFS= read -r -d $'\0' f; do
  FN=$(basename "$f")
  FN="${FN// /_}"
  FN="${FN//%20/}"
  echo "'http://pyplanetmedia.getserved.net/$FN',"
done