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!

Antworten (2)

Walter Roberson
Walter Roberson am 2 Mai 2020

1 Stimme

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

4 Kommentare

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

Melden Sie sich an, um zu kommentieren.

Ameer Hamza
Ameer Hamza am 2 Mai 2020

0 Stimmen

3 Kommentare

Tiger
Tiger am 2 Mai 2020
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 am 2 Mai 2020
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.

Melden Sie sich an, um zu kommentieren.

Gefragt:

am 2 Mai 2020

Community Treasure Hunt

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

Start Hunting!

Translated by