Skip to content

Instantly share code, notes, and snippets.

@jgatjens
Created July 26, 2016 05:22
Show Gist options
  • Save jgatjens/1e12936329109d06fa54939c5ca9d670 to your computer and use it in GitHub Desktop.
Save jgatjens/1e12936329109d06fa54939c5ca9d670 to your computer and use it in GitHub Desktop.
Upload folder to a FTP using lftp command.
#!/bin/bash
read -p "Are you sure you want to go to production? <y/N> " prompt
if [[ $prompt =~ [yY](es)* ]]
then
echo "---- UPDATE example.net SITE ----"
HOST="ftp.example.net"
USER="username"
PASS="password"
FTPURL="ftp://$USER:$PASS@$HOST"
LCD="/Users/username/Sites/project-name"
RCD="/public_html"
lftp -c "set ftp:list-options -a; \
open '$FTPURL'; \
lcd $LCD; \
cd $RCD; \
mirror --reverse --delete --only-newer --use-cache --verbose --allow-chown \
--allow-suid --no-umask --parallel=2"
else
echo "Becarefull, bye !!"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment