]> git.dabkitsch.com - sonogarden_maxproj.git/commitdiff
adding archive script
authorequilet <2237372+equilet@users.noreply.github.com>
Wed, 23 Apr 2025 01:41:45 +0000 (18:41 -0700)
committerequilet <2237372+equilet@users.noreply.github.com>
Wed, 23 Apr 2025 01:41:45 +0000 (18:41 -0700)
archive.zsh [new file with mode: 0755]

diff --git a/archive.zsh b/archive.zsh
new file mode 100755 (executable)
index 0000000..9c4c71f
--- /dev/null
@@ -0,0 +1,25 @@
+#!/bin/zsh
+
+# Set the source directory (you can customize this or pass it as an argument)
+SOURCE_DIR="$1"
+
+# Check if the source directory is provided
+if [[ -z "$SOURCE_DIR" ]]; then
+  echo "Usage: $0 /path/to/source-directory"
+  exit 1
+fi
+
+# Ensure source directory exists
+if [[ ! -d "$SOURCE_DIR" ]]; then
+  echo "Error: Source directory does not exist."
+  exit 1
+fi
+
+# Generate a timestamped folder name on the Desktop
+DEST_DIR="$HOME/Desktop/Copy_$(basename "$SOURCE_DIR")_$(date +%Y%m%d_%H%M%S)"
+
+# Use rsync to copy, excluding .git and .gitignore
+rsync -av --exclude='.git/' --exclude='.gitignore' "$SOURCE_DIR"/ "$DEST_DIR"
+
+echo "Copied contents to: $DEST_DIR"
+