2013-07-16 5 views
5

rsync에서 ".rsync-exclude"파일의 내용과 관계없이 특정 이름의 파일이 포함 된 모든 디렉토리를 제외 시키길 원합니다. -exclude "파일.rsync에서 특정 이름의 파일을 포함하는 모든 디렉토리 제외

".rsync-exclude"파일에 "*"만 있으면, rsync -r SRC DEST --filter='dir-merge,- .rsync-exclude'을 사용할 수 있습니다.

그러나 ".rsync-exclude"파일의 내용과 관계없이 디렉토리를 제외해야합니다 (적어도 ".rsync-exclude"파일을 비워 둘 수 있어야합니다).

아이디어가 있으십니까?

답변

4

rsync와는 (적어도 맨 아무것도 언급하지 않음)이 기능을 지원하지 않습니다,하지만 당신은 두 단계를 수행 할 수 있습니다 .rsync-exclude 파일을

  • 관이 목록을 찾을 수

    1. 실행 find

      --exclude-from=FILE 
           This option is related to the --exclude option, but it specifies a FILE that contains exclude patterns 
           (one per line). Blank lines in the file and lines starting with ';' or '#' are ignored. If FILE is -, 
           the list will be read from standard input. 
      

    대안 경우 --exclude-from (또는 사용하는 임시 파일)

     -F  The -F option is a shorthand for adding two --filter rules to your command. The first time it is used 
          is a shorthand for this rule: 
    
          --filter='dir-merge /.rsync-filter' 
    
          This tells rsync to look for per-directory .rsync-filter files that have been sprinkled through the 
          hierarchy and use their rules to filter the files in the transfer. If -F is repeated, it is a short- 
          hand for this rule: 
    
          --filter='exclude .rsync-filter' 
    
          This filters out the .rsync-filter files themselves from the transfer. 
    
          See the FILTER RULES section for detailed information on how these options work. 
    
  • 4

    오래된 질문을,하지만 난 같은 하나 ..

    다음과 같은 필터를 추가 할 수 있었다 : 당신이 파일에 무언가를 넣어 상관 없어, 당신은 사용할 수 있습니다

    --filter="dir-merge,n- .rsync-exclude" 
    

    이제 모든 폴더에 .rsync-exclude 파일을 배치하고 한 줄씩 제외 할 파일 및 폴더의 이름을 쓸 수 있습니다. 예 :

    #.rsync-exclude file 
    
    folderYouWantToExclude 
    allFilesThatStartWithXY* 
    someSpecialImage.png 
    

    그래서 패턴도 사용할 수 있습니다.

    당신이 할 수없는 것은 :

    #.rsync-exclude file 
    
    folder/someFileYouWantToExlude 
    

    는 희망이 도움이! 건배

    관련 문제