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)
入力引数
SFTP または FTP サーバーへの接続。SFTP オブジェクトまたは FTP オブジェクトとして指定します。
SFTP または FTP サーバー上にあるターゲット フォルダーの名前。文字ベクトルまたは string スカラーとして指定します。現在フォルダーの上位にあるフォルダーを指定するには、'..' を使用します。
ヒント
ログイン フォルダーに移動するには、関数
cdに~記号を渡します。
バージョン履歴
R2006a より前に導入
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の MathWorks のサイトは、お客様の地域からのアクセスが最適化されていません。
南北アメリカ
- América Latina (Español)
- Canada (English)
- United States (English)
ヨーロッパ
- 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)