Reputation: 11
I am trying to download some files from FTP and save on local folder.I tried this code but it does not work correctly.Anybody can help me?? Thank you in advance
ftp_client = ftp('n5eil01u.ecs.nsidc.org');
% ff=cd(ftp_client, '/pub/MOST/MOD10A1.005/2000.02.26');
m=dir(ftp_client, 'SAN/MOST/MOD10A1.005/2000.02.26/*.xml');
filename={m.name};
for k=1:length(filename)
name =filename{k}(2:end-1)
if isequal(name(19),'2')==1 && (isequal(name(20),'1')==1 || isequal(name(20),'2')==1 || isequal(name(20),'3')==1) && isequal(name(22),'0')==1 && (isequal(name(23),'5')==1 || isequal(name(23),'6')==1)
mget(ftp_client, '*.xml', 'E:\myfolder')
end
end
I get this message:
"Undefined function or method 'mget' for input arguments of type 'cell' "
I want to loop over all files and download specific files so add FOR to above code.
Upvotes: 0
Views: 1731
Reputation: 36720
Please check the documentation for mget
. Filename is second and not first input parameter and you have to call mget
for each file individually in a loop.
Upvotes: 1