Skip to content

Instantly share code, notes, and snippets.

@james2doyle
Created August 19, 2015 15:48
Show Gist options
  • Save james2doyle/5f10480d597111f69b9d to your computer and use it in GitHub Desktop.
Save james2doyle/5f10480d597111f69b9d to your computer and use it in GitHub Desktop.
LFTP Mirror settings
#!/bin/bash
HOST="0.0.0.0"
USER="ftpusername"
PASS="ftppassword"
PORT="21"
FTPURL="ftp://$USER:$PASS@$HOST:$PORT"
LCD="$(pwd)" # pwd returns the directory you are working in
RCD="/nested-remote-directory"
#DRYRUN="--dry-run"
#DELETE="--delete"
#EXISTING="--only-existing"
#GLOBS="--exclude-glob a-dir-to-exclude/ \
# --exclude-glob a-file-to-exclude \
# --exclude-glob a-file-group-to-exclude* \
# --exclude-glob other-files-to-exclude"
SSL="set ssl-allow true;
set ssl:verify-certificate no;"
lftp -c "set ftp:list-options -a;
$SSL
open '$FTPURL';
lcd $LCD;
cd $RCD;
mirror --reverse \
$DRYRUN \
$DELETE \
$EXISTING \
--verbose \
--use-cache \
$GLOBS \
--only-newer"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment