% get missing files - if net interruption etc
dont use this - you can take some code from it but
do so carefully!
% etldir='P:'
% missdir='10019'
% 
% dbg=1;
% lastdir=missdir;
% load etl.mat
% metfilelist = dir ([ etldir '/'  lastdir '/met*.txt']);
% numetl=length(metfilelist);
% if dbg==1
%     fprintf('%d files on %s \n',numetl, [etldir '/' lastdir]);
% end
% % see what we've got
% myfilelist = dir(['data/etl/read/met0' lastdir '*.txt' ]);
% % file names like:  met01000314_raw.txt
% numold=length(myfilelist);
% if dbg==1
%     fprintf('%d  local files\n',numold);
% end
% if numold < numetl,
%     for iex=1:numetl
%         cfile=[ etldir '/'  lastdir '/' metfilelist(iex).name ];
%         if exist(['data/etl/read/' metfilelist(iex).name],'file') == 0
%             if dbg==1
%                 disp(['will copyfile( ' cfile, ' to data/etl/new)']);
%             end
%             copyfile(cfile, 'data/etl/new');
%             newfiles=newfiles + 1;
%         end
%     end
% end
% 
% day1=datenum(2010,1,0);
% newfiles=dir('data/etl/new/met*.txt');
% for iiif = 1:length(newfiles),
%     fname=newfiles(iiif).name;
%     infile=['data/etl/new/' fname];
%     fprintf('%d %s  ',iiif, infile);
%     %% now get the data from this file
%     newetl=get_etl(infile,day1);
%     if exist('etl','var') && isstruct(etl)
%         etl=structsadd(etl,newetl);
%     else
%         etl=newetl;
%     end
%     save etl.mat etl
%     try
%         movefile ( infile, 'data/etl/read');
%     catch
%         % always says it can't, but it does move the file
%         fprintf('can not move %s to data/read',infile);
%     end
% end
% addpath('../../structures')
% newfiles=dir('data/etl/new/met*.txt');
% for iiif = 1:length(newfiles),
%     fname=newfiles(iiif).name;
%     infile=['data/etl/new/' fname];
%     fprintf('%d %s  ',iiif, infile);
%     %% now get the data from this file
%     newetl=get_etl(infile,day1);
%     if exist('etl','var') && isstruct(etl)
%         etl=structsadd(etl,newetl);
%     else
%         etl=newetl;
%     end
%     save etl.mat etl
%     try
%         movefile ( infile, 'data/etl/read');
%     catch
%         % always says it can't, but it does move the file
%         fprintf('can not move %s to data/read',infile);
%     end
% end
% clear
% load etl.mat
% indx=sort(etl.mday)
% length(etl.mday)
% length(indx)
% etl=structsort(etl, indx)
% whos
% etl
% [j,indx]=sort(etl.mday);
% etl=structsort(etl, indx)
% save etl.mat etl
% % 
% % 
% % % now set in set_up as etldir
% % %DATADIR = '\\Ps3das01\SharedDocs';
% % % workgroup psd3, system ps3das02
% % 
% % % directories are YYDDD, e.g. 10003 for Jan 3 2010
% % dv=datevec(now);
% % my_year=dv(1) - 2000; yrstr=num2str(my_year);
% % 
% % % see what's on the server:
% % edirs= dir([etldir '/' yrstr '*']);
% % %lastdir= edirs(end).name;    % 10003
% % lastdir='10014'
% % metfilelist = dir ([ etldir '/'  lastdir '/met*.txt']);
% % numetl=length(metfilelist);
% % if dbg==1
% %     fprintf('%d files on %s \n',numetl, [etldir '/' lastdir]);
% % end
% % % see what we've got
% % myfilelist = dir(['data/etl/read/met0' lastdir '*.txt' ]);
% % % file names like:  met01000314_raw.txt
% % numold=length(myfilelist);
% % if dbg==1
% %     fprintf('%d  local files\n',numold);
% % end
% % if numold < numetl,
% %     for iex=1:numetl
% %         cfile=[ etldir '/'  lastdir '/' metfilelist(iex).name ];
% %         if exist(['data/etl/read/' metfilelist(iex).name],'file') == 0
% %             if dbg==1
% %                 disp(['will copyfile( ' cfile, ' to data/etl/new)']);
% %             end
% %             copyfile(cfile, 'data/etl/new');
% %             newfiles=newfiles + 1;
% %         end
% %     end
% % end
% % 
