function [files]=get_files_from_url(url_base);
% GET_FILES_FROM_URL Return list of NetCDF files found in a URL directory
% url base should look like:
% http://stellwagen.er.usgs.gov/opendap/ARGO_MERCHANT/
s=urlread(url_base);
f1=strfind(s,'.cdf.html">');
f2=strfind(s,'.cdf');
k=0;
% with switch to hyrax, needed to change the equation for making the
% filename list, since there are 2 things found for f1 for each f2.
%for i=1:length(f1);
for i=1:2:length(f1);
k=k+1;
if k==29; keyboard; end
% files{k}=s(f1(i)+11:f2(i)+3);
%files{k}=s(f1(i)+10:f2(floor(i/2)+1)+2);
%needs this 9/17/10 on linux
files{k}=s(f1(i)+11:f2(floor(i/2)+1)+3);
end
f1=strfind(s,'.nc.html">');
f2=strfind(s,'.nc');
%for i=1:length(f1);
for i=1:2:length(f1);
k=k+1;
%if k==29; keyboard; end
% files{k}=s(f1(i)+10:f2(i)+2);
files{k}=s(f1(i)+10:f2(floor(i/2)+1)+2);
% needs this 9/17/10 on linux
%files{k}=s(f1(i)+11:f2(floor(i/2)+1)+3);
end
% for local directories, you have to do this:
% but a condition is needed so that you're NOT re-doing cdf's in web files
if ~(strncmp(url_base,'http',4))
f1=strfind(s,'.cdf');
strt=1;
for i=1:length(f1);
k=k+1;
if k==29; keyboard; end
% files{k}=s(f1(i)+10:f2(i)+2);
files{k}=s(strt:f1(i)+4);
strt=f1(i)+5;
end
end
% and for stellwagen's TDS (subset below), this seems to work
% dataset=BBV/CHANDELEUR/899p-cal.nc'>899p-cal.nc
f1=strfind(s,'.nc''>');
f2=strfind(s,'.nc');
for i=1:length(f1);
k=k+1;
files{i}=s(f1(i)+9:f2(i)+2);
end