Created
September 17, 2017 02:34
-
-
Save LC43/08b2343bee53c99e3c593e1b74d340f2 to your computer and use it in GitHub Desktop.
Compress directory, excluding dev files
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
#!/bin/bash | |
function wp_make_theme() { | |
local curdate=`date +%Y-%m-%d-%H%M%S` | |
local exclude=''; | |
local name=${1%/} | |
if [ -f ./exclude_prod ]; then | |
exclude="./exclude_prod"; | |
elif [ -f ~/.exclude_prod ]; then | |
exclude="$HOME/.exclude_prod"; | |
fi | |
if [ "$2" == "zip" ]; then | |
zip "$1-${curdate}-prod.zip $1" -r | |
else | |
tar --exclude-vcs --exclude-from="${exclude}" -cvJf "$name-${curdate}-prod.tar.xz" "$1" | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment