From eddb76ad8c6e850c7e24f97ff27a185d48b104ee Mon Sep 17 00:00:00 2001 From: Sadeep Madurange Date: Wed, 6 May 2026 19:08:45 +0800 Subject: Ensure 16 KB content in test files. --- seed.sh | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100755 seed.sh diff --git a/seed.sh b/seed.sh new file mode 100755 index 0000000..f6f817d --- /dev/null +++ b/seed.sh @@ -0,0 +1,37 @@ +#!/bin/ksh + +# Accept directory count as an argument, default to 500 +TOTAL=${1:-500} + +# Define the base path relative to the script location +SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd) +BASE_DIR="$SCRIPT_DIR/_site/log" + +# Target size: 16000 bytes is ~15.6 KB +CONTENT_SIZE=16000 + +# Ensure the target directory exists +mkdir -p "$BASE_DIR" + +for i in $(seq 1 $TOTAL); do + DIR="$BASE_DIR/site_$i" + mkdir -p "$DIR" + + # Start the file structure + echo "Site $i

" > "$DIR/index.html" + + # Generate random text using dd for byte-level precision + # We read 32KB of raw data to account for characters filtered out by tr, + # then use dd again to trim the result to exactly CONTENT_SIZE bytes. + dd if=/dev/urandom bs=32768 count=1 2>/dev/null | tr -dc 'a-zA-Z0-9 ' | dd bs=1 count=$CONTENT_SIZE 2>/dev/null >> "$DIR/index.html" + + # Append keyword and close tags + echo " Searchable content here for keyword_$i.

" >> "$DIR/index.html" + + # Print progress every 100 files + if [ $((i % 100)) -eq 0 ]; then + echo "Created $i files..." + fi +done + +echo "Done! $TOTAL directories created in $BASE_DIR." -- cgit v1.2.3