Skip to content

Instantly share code, notes, and snippets.

@philipp-r
Created June 23, 2023 07:26
Show Gist options
  • Save philipp-r/4393e8002bfc61adfab6c2c1c7a417cd to your computer and use it in GitHub Desktop.
Save philipp-r/4393e8002bfc61adfab6c2c1c7a417cd to your computer and use it in GitHub Desktop.
Mirror files from FTP server to local server (here to backup the Dokuwiki)
#!/bin/bash
HOST='ftp.example.com'
USER='username'
PASS='password'
REMOTEFOLDER='/var/www'
LOCALFOLDER='/home/backup/ftpcopy'
lftp -f "
open $HOST
user $USER $PASS
lcd $REMOTEFOLDER
mirror --exclude data/cache/ --exclude data/index/ --exclude data/locks/ --exclude data/tmp/ --continue --delete --verbose $REMOTEFOLDER $LOCALFOLDER
bye
"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment