Skip to content

Instantly share code, notes, and snippets.

@Hamcha
Created October 13, 2012 12:22
Show Gist options
  • Save Hamcha/3884430 to your computer and use it in GitHub Desktop.
Save Hamcha/3884430 to your computer and use it in GitHub Desktop.
ZSH file for easy ftp uploading from terminal (requires NCFTP Client)
FTP_HOST=your.host.here
FTP_DIR=www/
FTP_USER=yourFTPusername
FTP_PASS=yourFTPpassword
ftp-upload() {
if [[ $1 == '' ]]; then
print -P $FG[001]"Please specify one or more files"$FX[reset]
return
fi
DIR=
vared -p $FG[006]'Where would you like to upload? : '$FX[reset]$FX[bold] DIR
print -P $FX[reset]$FG[006]
ncftpput -R -m -u $FTP_USER -p $FTP_PASS $FTP_HOST $FTP_DIR$DIR $@ && print -P $FG[002]"Uploaded to "$FX[bold]$FG[007]"http://$FTP_HOST/$DIR"$FX[reset] || print -P $FG[001]"OOPS! Something went wrong :("$FX[reset]
}
alias upload="ftp-upload"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment