blob: 9d851082691c89e21a1aae111f8393ca225401fa (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
#!/bin/ksh
# Set the number of files/dirs
TOTAL=10000
# Approximate size in blocks
BLOCK_SIZE=16
COUNT=1
for i in $(seq 1 $TOTAL); do
# Create a unique directory name
DIR="site_$i"
mkdir -p "$DIR"
# 1. Generate random valid ASCII (valid UTF-8) text
# We read more from urandom than needed because tr will filter some out
dd if=/dev/urandom bs=1024 count=$BLOCK_SIZE 2>/dev/null | tr -dc 'a-zA-Z0-9 \n' > "$DIR/index.html"
# 2. Append the necessary HTML structure so your Perl regexes work
# This adds the <title> and <main> tags your script looks for
echo "<html><head><title>Site $i</title></head><body><main><p>Searchable content here for keyword_$i. Lorem ipsum text follows.</p></main></body></html>" >> "$DIR/index.html"
# Optional: print progress every 100 files
if [ $((i % 100)) -eq 0 ]; then
echo "Created $i files..."
fi
done
echo "Done! 10000 directories created with valid text."
|