cd
SFTP 또는 FTP 서버에서 현재 폴더 변경 또는 보기
설명
예제
폴더 변경 및 내용 나열하기
SFTP 객체를 생성하여 SFTP 서버에 대한 연결을 엽니다. SFTP 객체를 사용하여 서버에 있는 하위 폴더의 내용을 나열합니다. SFTP 세션이 종료되면 연결을 닫습니다.
먼저, 예제 SFTP 서버에 연결합니다.
s = sftp("sftp.example_galapagos.net","jsmith")
SFTP with properties: Host: "sftp.example_galapagos.net" Username: "jsmith" Port: 22 ServerSystem: "unix" DatetimeType: "datetime" ServerLocale: "en_US" DirParserFcn: @matlab.io.ftp.parseDirListingForUnix RemoteWorkingDirectory: "/home/jsmith"
최상위 폴더의 내용을 나열합니다.
dir(s)
air_quality fish insects README.txt birds INDEX.txt mammals reptiles climate index.html rainfall sftp.html
dir
함수를 사용하여 하위 폴더의 내용을 나열합니다.
dir(s,"home/jsmith/birds")
albatrosses ducks herons parrots avocets_stilts falcons kingfishers pelicans barn_owls flamingos mockingbirds penguins blackbirds frigatebirds nightjars pheasants boobies grebes northern_storm_petrels pigeons cardinal grosbeaks guineafowl osprey plovers cormorants gulls owls rails cuckoos hawks oystercatcher sandpipers
cd
함수를 사용하여 하위 폴더로 변경합니다. cd
의 출력값은 현재 MATLAB 폴더가 아닌 SFTP 서버에 있는 현재 폴더의 경로입니다.
cd(s,"home/jsmith/birds/herons")
ans = "home/jsmith/birds/herons"
현재 폴더의 내용을 나열합니다.
dir(s)
documentation great_egret_data migration_patterns great_blue_heron_data green_heron_data nesting_behaviors
SFTP 서버와의 연결을 닫습니다. SFTP 객체를 삭제하거나 연결이 시간 초과되도록 하여 연결을 닫을 수도 있습니다.
close(s)
입력 인수
s
— SFTP 또는 FTP 서버와의 연결
SFTP 객체 | FTP 객체
SFTP 또는 FTP 서버와의 연결로, SFTP 객체 또는 FTP 객체로 지정됩니다.
folder
— 대상 폴더 이름
문자형 벡터 | string형 스칼라
SFTP 또는 FTP 서버의 대상 폴더 이름으로, 문자형 벡터 또는 string형 스칼라로 지정됩니다. 현재 폴더의 상위 폴더를 지정하려면 '..'
를 사용하십시오.
팁
로그인 폴더로 이동하려면
cd
함수에~
기호를 전달하십시오.
버전 내역
R2006a 이전에 개발됨
MATLAB 명령
다음 MATLAB 명령에 해당하는 링크를 클릭했습니다.
명령을 실행하려면 MATLAB 명령 창에 입력하십시오. 웹 브라우저는 MATLAB 명령을 지원하지 않습니다.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)