Skip to content

Instantly share code, notes, and snippets.

@philipp-r
Created November 15, 2022 09:41
Show Gist options
  • Save philipp-r/818e0d36dfd3a994a8a9d5f4042047a7 to your computer and use it in GitHub Desktop.
Save philipp-r/818e0d36dfd3a994a8a9d5f4042047a7 to your computer and use it in GitHub Desktop.
Backup files from FTP with lftp to a local folder
#!/bin/bash
HOST='ftp.example.com'
USER='username'
PASS='password'
REMOTEFOLDER='/var/www'
LOCALFOLDER='/home/user/backup'
lftp -f "
open $HOST
user $USER $PASS
lcd $REMOTEFOLDER
mirror --exclude data/cache/ data/temp/ data/logs/ --continue --delete --verbose $REMOTEFOLDER $LOCALFOLDER
bye
"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment