Câu trả lời:
rsync -a --include='*.txt' --include='*.jpg' --exclude='*' root@somewhere:/folder/remote/ .
(Lưu ý rằng trận chung kết /tại /folder/remote/, và vị trí của --exclude='*'sau bao gồm quy tắc, rất quan trọng.) Trong vỏ mà mở rộng sự ủng hộ cú đúp (ví dụ bash, ksh, zsh):
rsync -a --include='*.'{txt,jpg} --exclude='*' root@somewhere:/folder/remote/ .
Thêm --include='*/' --prune-empty-dirsnếu bạn muốn sao chép các tập tin trong thư mục con là tốt.