FTP server returns blank directories and files

4 ビュー (過去 30 日間)
Russell Nasrallah
Russell Nasrallah 2018 年 7 月 31 日
コメント済み: Kojiro Saito 2021 年 1 月 19 日
Hello Everyone, I am having a basic issue accessing data from an NOAA FTP server. I am unsure as to whether this is a firewall problem or not. When I execute the code below I am shown a blank directory even though I know there are files within the directory in question.
Any help or suggestions would be appreciated.
%connect to ftp server
ftpobj = ftp('ftp.ncep.noaa.gov')
cd(ftpobj,'pub/data/nccf/com/nwps/prod/er.20180730/mhx/12/CG1/')
listing = dir(ftpobj)
Outputs look like below:
ftpobj =
FTP Object
host: ftp.ncep.noaa.gov
user: anonymous
dir: /
mode: binary
ans =
'/pub/data/nccf/com/nwps/prod/er.20180730/mhx/12/CG1'
listing =
[]

回答 (1 件)

Kojiro Saito
Kojiro Saito 2018 年 8 月 1 日
This is because MATLAB's FTP class does not have passive mode capability. https://www.mathworks.com/matlabcentral/answers/102638-
You can use passive FTP mode by using codes downloaded from this File Exchange.
Or, simply, you can use websave instead.
outfilename = websave('mhx_nwps_CG1_20180730_1200.grib2', 'http://www.ftp.ncep.noaa.gov/data/nccf/com/nwps/prod/er.20180730/mhx/12/CG1/mhx_nwps_CG1_20180730_1200.grib2');
  2 件のコメント
Stijn Stuart
Stijn Stuart 2021 年 1 月 19 日
I'm having exactly the same problem as Russell.
When using websave, i'm getting the below error message because the ftp://... instead of http://... protocol is not suported by websave.
Error using websave (line 94)
The 'ftp' protocol specified in URL, 'ftp://ftp.strukton.com/UrlsLeanTamping.txt', is not supported. Specify the URL with the protocol 'http://' or 'https://'.
Kojiro Saito
Kojiro Saito 2021 年 1 月 19 日
websave supports http or https protocol.
The URL might be 'https://ftp.strukton.com/UrlsLeanTamping.txt'.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeIntroduction to Installation and Licensing についてさらに検索

製品


リリース

R2017b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by