MATLAB Answers

how to do sequence for this case (alphabet)

1 view (last 30 days)
Matmien
Matmien on 3 Dec 2011
This command just for one file
ftpsite=ftp('website','username','password'); cd(ftpsite, 'ISK1/Hourly/210'); mget(ftpsite, 'isk1210b.zip'); unzip('isk1210b','C:\Multipath3SGU\MultipathMapping3SGU');
How i get more file with sequence command
cd(ftpsite, 'ISK1/Hourly/210');
mget(ftpsite, 'isk1210a.zip');
mget(ftpsite, 'isk1210b.zip');
mget(ftpsite, 'isk1210c.zip');
mget(ftpsite, 'isk1210d.zip');
mget(ftpsite, 'isk1210e.zip');
mget(ftpsite, 'isk1210f.zip');
mget(ftpsite, 'isk1210g.zip');
mget(ftpsite, 'isk1210h.zip');
mget(ftpsite, 'isk1210i.zip');
mget(ftpsite, 'isk1210j.zip');
mget(ftpsite, 'isk1210k.zip');
mget(ftpsite, 'isk1210l.zip');
mget(ftpsite, 'isk1210m.zip');
mget(ftpsite, 'isk1210n.zip');
%NEXT............................................ cd(ftpsite, 'ISK1/Hourly/220');
mget(ftpsite, 'isk1220a.zip');
mget(ftpsite, 'isk1220b.zip');
mget(ftpsite, 'isk1220c.zip');
mget(ftpsite, 'isk1220d.zip');
mget(ftpsite, 'isk1220e.zip');
mget(ftpsite, 'isk1220f.zip');
mget(ftpsite, 'isk1220g.zip');
mget(ftpsite, 'isk1220h.zip');
mget(ftpsite, 'isk1220i.zip');
mget(ftpsite, 'isk1220j.zip');
mget(ftpsite, 'isk1220k.zip');
mget(ftpsite, 'isk1220l.zip');
mget(ftpsite, 'isk1220m.zip');
mget(ftpsite, 'isk1220n.zip');

  0 Comments

Sign in to comment.

Answers (1)

Fangjun Jiang
Fangjun Jiang on 3 Dec 2011
One way to do it, construct your file names in the for-loops
for k={'1210','1220'}
for j='a':'n'
FileName=strcat('isk',k,j,'.zip')
mget(ftpsite,FileName);
end
end

  2 Comments

Matmien
Matmien on 4 Dec 2011
for k={'1210','1220'}
for j='a':'n'
FileName=strcat('isk',k,j,'.zip')
mget(ftpsite,FileName);
end
end
when i try to run.. some error detect..
error('MATLAB:ftp:FileUnavailable','File "%s" not found on server.',name);
Fangjun Jiang
Fangjun Jiang on 4 Dec 2011
You can see that the FileName is certainly correct. Try run the command mget(ftpsite, 'isk1220n.zip') at the command line. It you can get the file, then I would try adding a pause(n) statement after the mget() in the for-loop. n means n seconds which you can try and error to find the best value.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!

Translated by