2013-01-10 4 views
0
나는 /home/private_html/usery//home/private_html/userx/에서 완전한 디렉토리의 컨텐츠를 복사 할

은 문제가 디렉토리 userx 몇 심볼릭 링크가 포함되어 있는지, 그리고 cp를 사용할 때 그것은 단지 그들 (심볼릭 링크가 file에 지시하는 경우 스킵이 경우 경우에 발생 건너 뛰기 그것은 디렉토리를 가리키고, 단지 대신 전체 디렉토리를 복사합니다 ...).심볼릭 링크가 포함 된 전체 디렉토리를 복사하는 방법은 무엇입니까?

나는 다음과 같은 모양을 사용 된 명령

# cp -iprv /home/private_html/userx/ /home/private_html/usery/ 

는 사람은 누구나 다른 곳으로 "그것이 그대로"디렉토리를 복사 할 수있는 솔루션?

답변

0

FreeBSD에서 cp에는 -r 옵션이 없습니다. 그것은 당신이 원하는 일을해야하는, -R가 않습니다

-R If source_file designates a directory, cp copies the directory and 
     the entire subtree connected at that point. If the source_file 
     ends in a /, the contents of the directory are copied rather than 
     the directory itself. This option also causes symbolic links to be 
     copied, rather than indirected through, and for cp to create spe‐ 
     cial files rather than copying them as normal files. Created 
     directories have the same mode as the corresponding source direc‐ 
     tory, unmodified by the process' umask. 
0

롤랜드는 -R 플래그에 대한 권리입니다. 한 쌍의 tar 프로세스를 사용할 수도 있습니다. 이렇게하면 명령이 시스템 독립적 인 상태가됩니다.

tar -C /home/private_html/userx/ -cpf - . | tar -C /home/private_html/usery/ -epf -