ftp.sh:
#!/bin/bash
HOST=$1
USER="username"
PASS="password"
LCD=$2
RCD="/dingli_csv"
#DELETE="--delete"
lftp -c "set ftp:list-options -a;
open ftp://$USER:$PASS@$HOST ;
lcd $LCD;
mkdir $RCD;
mkdir $RCD/$3;
cd $RCD/$3;
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"
调用: ftp.sh 127.0.0.1 /home/user/data remote_data_dir
脚本中的用户名和密码还是需要调整