>

2014년 6월 9일 월요일

lftp mirror

어떤 ftp 사이트의 내용을 통째로 카피해오고 싶을때 사용하는 lftp의 미러링 방법.

This is when you want to copy all the files in an ftp site.

1. You need lftp installed in your computer.

    $ brew install lftp

2. make a bash file with the following contents. For example, make a file named mir.sh with the following.

#!/bin/bash
HOST="ftp_hostname"
USER="ftp_user_id"
PASS="password_for_the_id"
LOG_dir="/tmp/logs"
LCD="local_dir_where_the_files_go"
RCD="dir_of_the_ftp_site"

for ((;;)) // simply repeat. remove for-loop command if the ftp is very stable.
do

DATE=`date '+%Y-%m-%d_%H%M'`
lftp -c "set ftp:list-options -a;
open ftp://$USER:$PASS@$HOST;
lcd $LCD;
cd $RCD;
mirror --verbose --exclude-glob old/ --parallel=10 --log="$LOG_dir/GPL_$DATE" "

sleep 30m 

done 


3. make the file mir.sh executable:

    $ chmod +x mir.sh

4. run the command

    $ mir.sh

5. Wait until it finishes.

6. Press Control-C to stop the bash process.

댓글 없음:

댓글 쓰기