dateFormat = 'yyyy-mm-ddTHH:MM:SS.FFF';

token = 'YOUR TOKEN';
stationCodes = {'LOCATION CODE'};
%% 

wavDir = [pwd,filesep,'wavFiles',filesep];
if ~exist(wavDir,'dir')
    mkdir(wavDir)
end
deviceCodes = {'HYDROPHONE'};


for file=1:length(start)
    
    dateFrom = char(start(file));
    dateTo = char(stop(file));

    % uncomment this to get the files
    for iStation = 1:length(stationCodes)
        for iDev = 1:length(deviceCodes)
       % getOncArchivefileData(token,stationCodes{iStation},deviceCodes{iDev},'dateFrom',dateFrom,'dateTo',dateTo,...
        %    'fileExtension','fft','outputDirectory',fftDir);
            getOncArchivefileData(token,stationCodes{iStation},deviceCodes{iDev},'dateFrom',dateFrom,'dateTo',dateTo,...
                'fileExtension','wav','outputDirectory',wavDir);
        %getOncArchivefileData(token,stationCodes{iStation},deviceCodes{iDev},'dateFrom',dateFrom,'dateTo',dateTo,...
        %    'fileExtension','mat','outputDirectory',fftDir);
        %getOncArchivefileData(token,stationCodes{iStation},deviceCodes{iDev},'dateFrom',dateFrom,'dateTo',dateTo,...
        %    'fileExtension','wav','outputDirectory',fftDir);
        end
    end
end

