Programing

단일 파일을 RSYNC하는 방법은 무엇입니까?

crosscheck 2020. 10. 12. 07:14
반응형

단일 파일을 RSYNC하는 방법은 무엇입니까?


현재 나는 다음 Directories과 같이 RSync-ing합니다 .

* * * * * rsync -avz /var/www/public_html/images root@<remote-ip>:/var/www/public_html

그래서 rsync하나의 단일 파일은 /var/www/public_html/.htaccess어떻게합니까?


디렉토리와 동일한 방식으로 수행하지만 파일 이름의 전체 경로를 소스로 지정합니다. 귀하의 예에서 :

rsync -avz /var/www/public_html/.htaccess root@<remote-ip>:/var/www/public_html/

기본 구문

rsync options source destination

rsync -az /var/www/public_html/filename root@<remote-ip>:/var/www/public_html

더 읽어보기


Michael Place의 답변은 소스 및 대상의 루트 디렉토리에 비해 파일 경로의 모든 디렉토리가 이미 존재하는 경우 훌륭하게 작동합니다.

그러나 파일을이 소스 경로와 동기화하려면 어떻게해야합니까?

/ source-root / a / b / 파일

다음 대상 경로가있는 파일에 :

/ target-root / a / b / 파일

그리고 디렉토리 ab 가 존재하지 않습니까?

다음과 같은 rsync 명령을 실행해야합니다.

rsync -r --include="/a/" --include="/a/b/" --include="/a/b/file" --exclude="*" [source] [target]

참고 URL : https://stackoverflow.com/questions/14888012/how-to-rsync-a-single-file

반응형