From fda47a2f898a6ef2f85a4676099ee8c14c5f7c39 Mon Sep 17 00:00:00 2001 From: Stephen Waits Date: Sat, 30 Nov 2024 12:54:55 +0100 Subject: [PATCH] chore: add sync.sh for copying to main packages repo --- sync.sh | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100755 sync.sh diff --git a/sync.sh b/sync.sh new file mode 100755 index 0000000..a038016 --- /dev/null +++ b/sync.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +# Set the destination directory +DEST_DIR="$HOME/Code/typst-packages-fork/packages/preview" + +# Ensure the destination directory exists +mkdir -p "$DEST_DIR" + +# Loop through all directories in the current directory +for dir in preview/*/; do + if [ -d "$dir" ]; then + # Remove trailing slash from directory name + dir=${dir%/} + + echo "Syncing $dir to $DEST_DIR/$dir..." + + # Use rsync with these options: + # -a: archive mode (preserves permissions, timestamps, etc.) + # -v: verbose + # -z: compress during transfer + # --delete: remove files in dest that don't exist in source + rsync -avz --delete "$dir/" "$DEST_DIR/$dir/" + fi +done + +echo "Sync complete!"