close all
clear all

dpath = '134.89.12.189/data/';

while(1)
  dataDirs = dir([dpath 'R*']);

  for k = length(dataDirs):-1:1
      if(dataDirs(k).isdir == 1)
          ppath = [dpath dataDirs(k).name '/'];
          disp(['Processing Data Directory ' ppath]);
          
          files = dir([ppath 'D*']);
          
          for i = length(files):-1:1
             if(isempty(strfind(files(i).name,'.mat')))  %Not a .mat file
             
             %Check to see if a newer raw data file exists
             checkfiles = dir([ppath files(i).name '.mat']);
             if((isempty(checkfiles)) || (checkfiles.datenum < files(i).datenum))  %A .mat file doesn't exist or it is old 
                 disp(['Converting ' files(i).name]);
                 SurfaceLogFileDecoderRing(ppath,files(i).name);
             end
             end
          end
      end
  end
      
MakePlots
  
pause(10*60);

end