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 コマンド ウィンドウに入力して実行してください。Web ブラウザーは 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)