Created
July 21, 2014 03:45
-
-
Save aa65535/d6df1ff4e56e18167691 to your computer and use it in GitHub Desktop.
lftp同步脚本
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="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