Created
September 6, 2025 03:07
-
-
Save techcaotri/3d4da9fac539c1accc3806ba3069afa3 to your computer and use it in GitHub Desktop.
Script to batch-convert Dot files (e.g. created by Scitools Understand) to drawio
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| set -euo pipefail | |
| DOT_DIR="${DOT_DIR:-./ControlFlow_Reports/flowcharts_dot}" | |
| OUTPUT="${OUTPUT:-./ControlFlow_Reports/drawio}" | |
| # Ensure these are exported or set before running | |
| : "${DOT_DIR:?Need to set DOT_DIR}" | |
| : "${OUTPUT:?Need to set OUTPUT}" | |
| # Create output directory if not existing | |
| mkdir -p "$OUTPUT" | |
| # Loop through all .dot files | |
| for src in "$DOT_DIR"/*.dot; do | |
| # Skip if no .dot files present | |
| [[ -e "$src" ]] || continue | |
| # Derive basename and destination path | |
| base=$(basename "$src" .dot) | |
| dest="$OUTPUT/${base}.xml" | |
| echo "Converting '$src' → '$dest'…" | |
| graphviz2drawio "$src" -o "$dest" | |
| echo " ✔ Generated '$dest'" | |
| done | |
| echo "All done!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment