How to retrieve files from ftp website

Hi, I need to retreive .nc files in a loop from a web address that starts with ftp://
I tried mget, urlread, and webread and none seemed to work for me
Any assistance would be appreciated!

답변 (2개)

Walter Roberson
Walter Roberson 2020년 5월 2일

1 개 추천

You create a connection, and then you use cd() and mget() and so on on the object.

댓글 수: 4

just
mget(ftp('ftp://usgodae.org/pub/outgoing/argo/dac/aoml/13857/'), '13857_tech.nc')
which gives me:
Error using connect (line 22)
Could not open a connection to "ftp", port "NaN".
Error in ftp (line 75)
connect(h)
sorry if its a simple question, new to this sort of stuff
basically ftp://usgodae.org/pub/outgoing/argo/dac/aoml/ has folders with files I want
thanks!
Image Analyst
Image Analyst 2020년 5월 2일
Do you need a password to login to the site? If you do it via your web browser does it work?
Tiger
Tiger 2020년 5월 2일
Yup works in web browser, no password
obj = ftp('usgodae.org');
cd(obj, '/pub/outgoing/argo/dac/aoml/13857/');
mget(obj, '13857_tech.nc')
close(obj)

댓글을 달려면 로그인하십시오.

Ameer Hamza
Ameer Hamza 2020년 5월 2일

0 개 추천

댓글 수: 3

Tiger
Tiger 2020년 5월 2일
Thanks for the response. All these functions (including websave) say that any url that isn't http:// isn't supported, and the url I want starts with ftp:// so kinda in a rut :(
Ameer Hamza
Ameer Hamza 2020년 5월 2일
Can you show your code with mget().
outfilename = websave('13857_tech.nc', 'https://usgodae.org/pub/outgoing/argo/dac/aoml/13857/')
only brings down the HTML document, not the actual file.

댓글을 달려면 로그인하십시오.

질문:

2020년 5월 2일

댓글:

2020년 5월 3일

Community Treasure Hunt

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

Start Hunting!

Translated by