2014-07-20 4 views
0

용의주세요.Rsync/Linux : 대상 디렉토리 내에 새 디렉토리가 생성되지 않도록하십시오.

Rsync 사용에 관한 질문. 나는, 예를 들어,이 명령을 지정하는 경우 :

rsync -av Downloads Downloads2 

/Downloads2/다운로드가 내용을 모두 내 결과는 디렉토리 "Downloads2은"서브 디렉토리로 "다운로드"와 함께 만든 것입니다 원래의/Downloads 디렉토리.

rsync가/Downloads2/Downloads 구조를 만들지 않고/Downloads의 내용을/Downloads2로 복사 할 수있는 옵션이 있는지 궁금합니다.

답변

1

당신이 생성되고 그 디렉토리를 방지 할 소스 디렉토리에 후행 슬래시를 추가, "남자 rsync를"에서 볼 수 있듯이 :

  rsync -avz foo:src/bar/ /data/tmp 

    A trailing slash on the source changes this behavior to avoid creating 
    an additional directory level at the destination. You can think of a 
    trailing/on a source as meaning "copy the contents of this directory" 
    as opposed to "copy the directory by name", but in both cases the 
    attributes of the containing directory are transferred to the contain‐ 
    ing directory on the destination. In other words, each of the follow‐ 
    ing commands copies the files in the same way, including their setting 
    of the attributes of /dest/foo: 

      rsync -av /src/foo /dest 
      rsync -av /src/foo/ /dest/foo