Carlos Aguni

Highly motivated self-taught IT analyst. Always learning and ready to explore new skills. An eternal apprentice.


lftp mirror cheat cheet

08 Oct 2022 »

mirror.sh

#!/bin/bash

# FTP LOGIN
#curlftpfs#<username>:<password>@<hostname> <mountpoint> fuse rw,allow_other 0 0
HOST='<host>'
USER='<user>'
PASSWORD='<password>'

# DISTANT DIRECTORY
REMOTE_DIR='public_html/'

#LOCAL DIRECTORY
LOCAL_DIR="`pwd`/"

lftp -u "$USER","$PASSWORD" $HOST <<EOF
# the next 3 lines put you in ftpes mode. Uncomment if you are having trouble connecting.
# set ftp:ssl-force true
# set ftp:ssl-protect-data true
# set ssl:verify-certificate no
set ssl:verify-certificate no
# transfer starts now...
#set sftp:auto-confirm yes
mirror -e -R ./c2 public_html/c2;
mirror -e -R ./static public_html/static;
#mirror -e --ignore-time -R ./static public_html/static;
#mirror -v -e -n -R ./g public_html/;
exit
EOF
echo
echo "Transfer finished"
date