#!/bin/bash # Check if Inkscape is installed if ! command -v inkscape &> /dev/null then echo "Inkscape is not installed. Please install it and try again." exit 1 fi # Root directory to start the search ROOT_DIR="styles" # Function to convert SVG to PNG and PDF convert_svg() { local svg_file="$1" local dir=$(dirname "$svg_file") local filename=$(basename -- "$svg_file") local filename="${filename%.*}" # Convert to PNG inkscape --export-type=png --export-filename="${dir}/${filename}.png" "$svg_file" # Convert to PDF inkscape --export-type=pdf --export-filename="${dir}/${filename}.pdf" "$svg_file" echo "Converted $svg_file to PNG and PDF" } # Find all SVG files recursively and convert them find "$ROOT_DIR" -type f -name "*.svg" | while read svg_file; do convert_svg "$svg_file" done echo "Conversion complete!"