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)
binary(tmw);  %set FTP transfer type to binary

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

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

delete(tmw,'*.*');

try
   mput(tmw,[way_proc_data_flux, '*', jd, '*.txt']);
   mput(tmw,[way_images_flux, '*', jd, '*.jpg']);
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