#!/bin/bash
cd $(dirname $0)
cd ..
tempDir=$(mktemp -d)
sourceDir="."

find $sourceDir \
    -name "*" -and \
    -not \( \
        \( \
            -path "$sourceDir/app" \
            -path "$sourceDir/public" \
            -path "$sourceDir/vendor" \
            -path "$sourceDir/themes" \
        \) \
        -prune \
    \) -and \
    -not -name ".env" -and \
    -not -name ".htaccess" \
    -print

rsync -a --delete $sourceDir $tempDir
rsync -a --delete $tempDir/ .
rm -rf $tempDir