1
0
Fork 0

Add function to upload files via sftp

This commit is contained in:
tastytea 2022-03-19 06:27:22 +01:00
parent 24213efe5e
commit 60184ed7f3
Signed by: tastytea
SSH Key Fingerprint: SHA256:FBkvrOlhq5use1XEttyUGT4bUTDVA1ar9SgIc9P03cM
1 changed files with 21 additions and 0 deletions

View File

@ -0,0 +1,21 @@
#!/usr/bin/env zsh
# Put files on a webspace via sftp
if [[ ${ARGC} -eq 0 ]]; then
print -u 2 "Usage: ${0} <file> …" >&2
return 1
fi
local -a putcmds
for file in "${@}"; do
putcmds+="put ${file}"
done
sftp tastytea.de <<EOF
cd /var/www/tastytea.de/files/
$(print -l ${putcmds})
EOF
for file in "${@}"; do
print '\e[1;95m→\e[0m' https://tastytea.de/files/"${file##*/}"
done