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!

Answers (2)

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

4 Comments

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!
Do you need a password to login to the site? If you do it via your web browser does it work?
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)

Sign in to comment.

3 Comments

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 :(
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.

Sign in to comment.

Asked:

on 2 May 2020

Commented:

on 3 May 2020

Community Treasure Hunt

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

Start Hunting!