disp('ftp to NOAA server in Boulder')
clear dir
% write some files to voodoo/incoming
jd=num2str(ddd);

tmw=ftp('ftp.etl.noaa.gov','etlguest','ludovic.bariteau@noaa.gov');
% tmw=ftp('ftp.etl.noaa.gov','etlguest','RHB@noaa.gov');
dir(tmw)
ascii(tmw);  %set FTP transfer type to ASCII

mkdir(tmw,'psd3/lbariteau/');
cd(tmw,'psd3/lbariteau');

mkdir(tmw,['day', jd]);
c=cd(tmw,['day', jd]);

try
    mput(tmw,[way_images_flux, '*', jd, '*.jpg']);
    mput(tmw,[way_proc_data_flux, '*', jd, '*.txt']);
catch
    disp(['Files present in', c])
    dir(tmw)
    error('Files already uploaded on the server.')
end;

dr=dir(tmw);
disp('  ');
disp('%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%');
dir(tmw)
disp('%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%');
disp(['     <<<<<<<<  Number of files transfered: ', num2str(length(dr)), '    >>>>>>>>>>>>>>>']);
disp('%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%');

close(tmw);
clear tmw