Sindbad~EG File Manager
#!/bin/bash
# Configuration
REMOTE_USER="beeson"
REMOTE_HOST="208.69.40.113"
REMOTE_PORT="2222"
REMOTE_DIR="public_html/WebMathXpert/ThreeBodyWeb/images" # Correct remote location
LOCAL_DB="ThreeBodyDatabase.db"
LOCAL_SVG_DIR="./images" # Correct local destination
# Ensure local directory exists
mkdir -p "$LOCAL_SVG_DIR"
# Get list of SVG filenames from local DB into a temporary file
echo "Extracting SVG filenames from database..."
sqlite3 "$LOCAL_DB" "SELECT image_filename FROM documents WHERE image_filename IS NOT NULL AND image_filename != '';" > svgs_to_fetch.txt
# Check if the list is empty
if [ ! -s svgs_to_fetch.txt ]; then
echo "No SVG filenames found in the database."
rm svgs_to_fetch.txt
exit 1
fi
# Fetch each SVG
echo "Fetching SVGs from server..."
while IFS= read -r filename; do
echo "Downloading: $filename"
scp -P "$REMOTE_PORT" "$REMOTE_USER@$REMOTE_HOST:$REMOTE_DIR/$filename" "$LOCAL_SVG_DIR/"
done < svgs_to_fetch.txt
rm svgs_to_fetch.txt
echo "SVG sync completed on $(date)"
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists