● lftp 설치

# yum install -y lftp

ssh로 연결하여 복사하기

# lftp -u '사용자ID','사용자암호' -p 22 sftp://백업해야할서버의IP -e "mirror -a --only-newer /home/원격서버의경로 /home/내려받을경로 && bye"

옵션

--delete                remote site에 없는 파일 삭제

--only-existing       target에 존재하는 파일만 다운로드

--only-newer         새로운 파일만 다운로드

--no-recursion       subdirectory는 무시

--reverse              역방향으로 mirror (get이 아닌 put)


한글문제(euc-kr)

utf-8 환경에서 한글파일명을 전송할 경우 문제가 발생할 수 있다.

해결을 위해서 /etc/lftp.conf 파일을 수정한다.

man lftp 로 찾아보면 아래와 같은 설정이 있다.

set file:charset utf-8
set ftp:charset euc-kr

위 두줄을 /etc/lftp.conf 파일에 추가해준다.

+ Recent posts