function [UnZippedFileName] = UnZipFiles(path,file)


global temp_path;
global DecodedResults_path;

filename = file.name;

if(strcmp(filename(end-2:end),'.gz'))  %It's a zipped file.
  UnZippedFileName = filename(1:end-3);
else
  UnZippedFileName = filename;
end

DecodedFile = dir([DecodedResults_path UnZippedFileName(1:end-4) '.mat']);

if(isempty(DecodedFile) || (DecodedFile.datenum < file.datenum))
  cmd = ['cp ' path filename ' ' temp_path filename];
  unix(cmd);

  if(strcmp(filename(end-2:end),'.gz'))  %It's a zipped file.
   cmd = ['gunzip -f ' temp_path filename];
   unix(cmd);
  end

ConvertLogFiles(temp_path,UnZippedFileName(1:end-4));


disp('About to move file');
cmd = ['mv ' temp_path UnZippedFileName(1:end-4) '*.mat ' DecodedResults_path];
unix(cmd);

disp('About to rm files');
cmd = ['rm ' temp_path UnZippedFileName(1:end-4) '*'];
unix(cmd);

disp('About to call MakeQuickViewPlots');
MakeQuickViewPlots(DecodedResults_path,UnZippedFileName(1:end-4));


end




end


