![하나의 명령으로 두 가지 파일 형식을 동기화하시겠습니까?](https://linux55.com/image/42324/%ED%95%98%EB%82%98%EC%9D%98%20%EB%AA%85%EB%A0%B9%EC%9C%BC%EB%A1%9C%20%EB%91%90%20%EA%B0%80%EC%A7%80%20%ED%8C%8C%EC%9D%BC%20%ED%98%95%EC%8B%9D%EC%9D%84%20%EB%8F%99%EA%B8%B0%ED%99%94%ED%95%98%EC%8B%9C%EA%B2%A0%EC%8A%B5%EB%8B%88%EA%B9%8C%3F.png)
같은 경로를 반복하지 않고 어떻게 한 줄에 쓸 수 있나요?
rsync -a root@somewhere:/folder/remote/*.txt .
rsync -a root@somewhere:/folder/remote/*.jpg .
답변1
나는 다음과 같이 쓸 것입니다 :
rsync -a root@somewhere:/folder/remote/*.{txt,jpg} .
답변2
rsync -a --include='*.txt' --include='*.jpg' --exclude='*' root@somewhere:/folder/remote/ .
/
(include 규칙의 마지막 항목과 /folder/remote/
뒤의 배치가 중요합니다.) 중괄호 확장을 지원하는 셸(예: bash, ksh, zsh):--exclude='*'
rsync -a --include='*.'{txt,jpg} --exclude='*' root@somewhere:/folder/remote/ .
--include='*/' --prune-empty-dirs
하위 디렉터리에도 파일을 복사하려면 해당 항목을 추가하세요.