#!/usr/bin/env bash ############################################################################### # Project Copy Script # # Copies a project while excluding generated and local-only directories. # # Excludes: # - vendor/ # - node_modules/ # - .git/ # - storage/ # - bootstrap/cache/ # - provision/ # # Usage: # ./copy-project.sh /path/to/source /path/to/destination # ############################################################################### set -euo pipefail if [ "$#" -ne 2 ]; then echo "Usage:" echo " $0 " exit 1 fi SOURCE="$(cd "$1" && pwd)" DEST="$2" echo "Source : $SOURCE" echo "Destination : $DEST" echo mkdir -p "$DEST" echo "Copying..." rsync -a \ --progress \ --delete \ --exclude=".git/" \ --exclude="vendor/" \ --exclude="node_modules/" \ --exclude="storage/" \ --exclude="bootstrap/cache/" \ --exclude="provision/" \ "$SOURCE/" \ "$DEST/" echo echo "Creating required empty directories..." mkdir -p "$DEST/storage" mkdir -p "$DEST/bootstrap/cache" touch "$DEST/storage/.gitkeep" touch "$DEST/bootstrap/cache/.gitkeep" echo echo "Done."