Skip to content

Instantly share code, notes, and snippets.

@aa65535
Created July 21, 2014 03:45
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aa65535/d6df1ff4e56e18167691 to your computer and use it in GitHub Desktop.
Save aa65535/d6df1ff4e56e18167691 to your computer and use it in GitHub Desktop.
lftp同步脚本
#!/bin/bash
HOST="123.123.123:21" # FTP服务器地址
USER="username" # FTP用户名
PASS="password" # FTP密码
SCD="/" # 远程根目录
LCD="/home/www/" # 本地根目录
LST="dir1 dir2 dir3" # 要同步的目录, 空格隔开
for RCD in $LST; do
mkdir -p $LCD$RCD
lftp -c "open ftp://$USER:$PASS@$HOST;
lcd $LCD$RCD;
cd $SCD$RCD;
mirror --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-esclude"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment