Last active
April 3, 2018 17:00
-
-
Save marsam/9279301 to your computer and use it in GitHub Desktop.
ftp mirror
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -e | |
host="ftp.example.com" | |
user="user" | |
pass="pasword" | |
ftpurl="ftp://${user}:${pass}@${host}" | |
local_dir="/path/to/local/dir" | |
remote_dir="documents" # Only mirror this remote dir | |
[[ -d $local_dir ]] || mkdir -p $local_dir | |
lftp -c "set ftp:list-options -a; | |
open '$ftpurl'; | |
lcd $local_dir; | |
cd $remote_dir; | |
mirror --verbose \ | |
--continue \ | |
" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment