Created
September 22, 2016 21:15
-
-
Save BrandonRomano/b2720ddf58e4ee1acb9d15fc80926251 to your computer and use it in GitHub Desktop.
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
sftp_user="" | |
sftp_host="" | |
deploy() { | |
local write_file="sftp-commands-$(date +%s).txt" | |
generate_command_file > "$write_file" | |
cat "$write_file" | sftp "$sftp_user"@"$sftp_host" | |
rm "$write_file" | |
} | |
generate_command_file() { | |
echo "mkdir deploy" | |
echo "cd deploy" | |
find . -print0 | while IFS= read -r -d '' file | |
do | |
if [[ -d "$file" && "$file" != "." ]]; then | |
echo "mkdir $file" | |
elif [[ -f "$file" ]]; then | |
local perms=$(stat -f '%A %a %N' gulpfile.js | cut -f1 -d " ") | |
echo "put $file $file" | |
echo "chmod $perms $file" | |
fi | |
done | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment