![sftp를 사용하여 디렉토리와 모든 내용을 얻는 방법은 무엇입니까? [복사]](https://linux55.com/image/43335/sftp%EB%A5%BC%20%EC%82%AC%EC%9A%A9%ED%95%98%EC%97%AC%20%EB%94%94%EB%A0%89%ED%86%A0%EB%A6%AC%EC%99%80%20%EB%AA%A8%EB%93%A0%20%EB%82%B4%EC%9A%A9%EC%9D%84%20%EC%96%BB%EB%8A%94%20%EB%B0%A9%EB%B2%95%EC%9D%80%20%EB%AC%B4%EC%97%87%EC%9E%85%EB%8B%88%EA%B9%8C%3F%20%5B%EB%B3%B5%EC%82%AC%5D.png)
sftp에서 명령을 사용하려고 하면 get
일반 파일이 아니라는 오류가 발생합니다. 해결책이 있나요?
답변1
sftp -r
디렉토리를 사용하여 호스트 에 연결할 수 있습니다 get
. 연결시 사용을 잊어버리신 경우에도 -r
사용하실 수 있습니다 get -r
.
sftp -r me@somehost
또는
sftp> get -r tmp/
Fetching /home/me/tmp/ to tmp
Retrieving /home/me/tmp
/home/me/new.orig.dmp 100% 417KB 416.8KB/s 00:00
/home/me/untangle.dmp 100% 398KB 398.3KB/s 00:00
/home/me/repos.orig.dmp 100% 415KB 415.2KB/s 00:00
/home/me/me-untangle.dmp 100% 32KB 32.4KB/s 00:00
sftp>
항상 배달을 보장하려면 -r
이를 별칭으로 추가하거나 유사한 이름으로 추가하세요 sftp
.~/.bashrc
alias sftp="sftp -r"
~에서man 1 sftp
-r Recursively copy entire directories when uploading and download‐
ing. Note that sftp does not follow symbolic links encountered
in the tree traversal.
.........
get [-Ppr] remote-path [local-path]
........
If either the -P or -p flag is specified, then full file permis‐
sions and access times are copied too.
If the -r flag is specified then directories will be copied
recursively. Note that sftp does not follow symbolic links when
performing recursive transfers.