How to download multiple folders using mget?

Hi,
Wondering if it is possible to use mget to download multiple folders?, where each folder has multiple files.
Here is my attempt...
clc, clear
username = 'xxx';
password = 'xxx';
ftpobj = ftp('ftp.blablabla',username,password);
cd(ftpobj, '/Forlder3/Forlder2/Forlder1');
dir(ftpobj)
mget(ftpobj,'C:\MyFolder');
% I believe to help with query...
hs = struct(ftpobj);
hs.jobject.setConnectionTimeout(50);
Thanks!

 Réponse acceptée

Walter Roberson
Walter Roberson le 9 Fév 2020

0 votes

Wondering if it is possible to use mget to download multiple folders?
You can use a wildcard with the list of things to get. If what you specify happens to match multiple folders, then they will be retrieved.

6 commentaires

Mario
Mario le 9 Fév 2020
Sorry I was not very specific before...
The folders are: 01, 02, ...12
In ach folder there are .nc and .png files.
I believe your suggestion should be something like this... mget(ftpobj,'\*\*.nc','C:\MyFolder');
However, I get neither error message nor data downloaded.
Any advice, much appreciated!
Walter Roberson
Walter Roberson le 9 Fév 2020
Modifié(e) : Walter Roberson le 9 Fév 2020
I would tend to suspect
mget(ftpobj,'*/*.nc','C:\MyFolder')
Mario
Mario le 9 Fév 2020
Tested and...
ans =
0×0 empty cell array
cd(ftpobj, '/Forlder3/Forlder2/Forlder1');
To confirm, what you want to retrieve is /Forlder3/Forlder2/Forlder1/*/*.nc ?
Mario
Mario le 10 Fév 2020
yes. thanks!
Walter Roberson
Walter Roberson le 10 Fév 2020
The only thing that I see is that you spelt Forlder instead of Folder

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by