close all
clear all

ppath = '134.89.12.189/data/R00001/';

while(1)


  cmd = ('!wget -m -c --no-passive-ftp -T 20 --tries=60 --progress=dot ftp://buoy:PowerBuoy@134.89.12.189/data/R00001');
  eval(cmd);


  files = dir([ppath 'D*']);

  idx = zeros(1,length(files));
  for i = 1:length(files)
    if(strfind(files(i).name,'.mat'))
      idx(i) = i;
      idx(i-1) = i;  %This is a kludge, relies of file ordering to keep from re-decoding a file that already has a .mat file
    end
  end

  for i = 1:length(files)

    if(~idx(i))
      filename = files(i).name
      path = ppath;
      SurfaceLogFileDecoderRing
    end
  end   

  
  MakePlots
  
pause(30*60);

end