Last active
August 29, 2015 14:08
-
-
Save tokhi/dd1c237cab817d32a645 to your computer and use it in GitHub Desktop.
Via script below you can download and sync directories from a remote ftp server to your local directory and vice versa. This script also support utf-8 filenames
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
#!/bin/bash | |
HOST="example.com" | |
USER="user" | |
PASS="password" | |
FTPURL="ftp://$USER:$PASS@$HOST" | |
echo $FTPURL | |
LCD="/home/user/local/directory" | |
RCD="/ftp/remote/directory" | |
# sync remote directory to the local directory (download) | |
lftp -c "set ftp:list-options -a; | |
open '$FTPURL'; | |
set file:charset utf8; | |
mirror -c $RCD $LCD " | |
# Syncing local directory with the remote direction and remove teh source file (enable delete if you wish for deletion) upload | |
#DELETE="--delete" | |
#lftp -c "set ftp:list-options -a; | |
#open '$FTPURL'; | |
#cd $RCD; | |
#lcd $LCD; | |
#mirror --reverse \ | |
# $DELETE \ | |
# --verbose \ | |
# --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" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment