"rsync"를 사용하여 디렉터리 및 파일(일부 유형 제외)을 대상에 복사하는 방법은 무엇입니까? 면제되거나 동기화되지 않는 파일 형식은 다음과 같습니다. *.odb, *.a3db
답변1
rsync 필터 기능을 사용할 수 있습니다. 예를 들어 다음 명령을 사용하십시오.
rsync -uva --filter="- *.odb" --filter="- *.a3db" /source-path/ /destination-path/
답변2
몇 가지 제외 패턴을 사용하세요.
rsync -av --exclude='*.odb' --exclude='*.a3db' source/ target/
예:
$ ls source
file-1.a3db file-2.odb file-4.a3db file-5.odb file-7.a3db file-8.odb
file-1.c file-2.txt file-4.c file-5.txt file-7.c file-8.txt
file-1.odb file-3.a3db file-4.odb file-6.a3db file-7.odb file-9.a3db
file-1.txt file-3.c file-4.txt file-6.c file-7.txt file-9.c
file-2.a3db file-3.odb file-5.a3db file-6.odb file-8.a3db file-9.odb
file-2.c file-3.txt file-5.c file-6.txt file-8.c file-9.txt
두 번 사용하면 -v
무엇이 포함되고 제외되는지 표시할 수 있습니다.
$ rsync -avv --exclude='*.odb' --exclude='*.a3db' source/ target/
sending incremental file list
[sender] hiding file file-1.odb because of pattern *.odb
[sender] hiding file file-1.a3db because of pattern *.a3db
[sender] hiding file file-2.odb because of pattern *.odb
[sender] hiding file file-2.a3db because of pattern *.a3db
[sender] hiding file file-3.odb because of pattern *.odb
[sender] hiding file file-3.a3db because of pattern *.a3db
[sender] hiding file file-4.odb because of pattern *.odb
[sender] hiding file file-4.a3db because of pattern *.a3db
[sender] hiding file file-5.odb because of pattern *.odb
[sender] hiding file file-5.a3db because of pattern *.a3db
[sender] hiding file file-6.odb because of pattern *.odb
[sender] hiding file file-6.a3db because of pattern *.a3db
[sender] hiding file file-7.odb because of pattern *.odb
[sender] hiding file file-7.a3db because of pattern *.a3db
[sender] hiding file file-8.odb because of pattern *.odb
[sender] hiding file file-8.a3db because of pattern *.a3db
[sender] hiding file file-9.odb because of pattern *.odb
[sender] hiding file file-9.a3db because of pattern *.a3db
delta-transmission disabled for local transfer or --whole-file
(남은 감산량)
$ ls target
file-1.c file-2.txt file-4.c file-5.txt file-7.c file-8.txt
file-1.txt file-3.c file-4.txt file-6.c file-7.txt file-9.c
file-2.c file-3.txt file-5.c file-6.txt file-8.c file-9.txt
파일이 source
.