function HURR_struct_array = readHURRpath( HURR_path )

HURR_struct_array = struct([]);

if ~exist('HURR_path') || isempty(HURR_path)
    % Load hurricane pathname used in last analysis, if available, otherwise create empty string:
    if exist('tmp_HURR_path.mat','file'), load('tmp_HURR_path'); end
    if ~exist('HURR_path','var') || ~isstr(HURR_path), HURR_path = ''; end
    HURR_path = uigetdir(HURR_path,'Select folder containing hurricane wind speeds');
    if any(HURR_path~=0)
        save('tmp_HURR_path','HURR_path');
    else
        HURR_struct_array(1).error = 1;
        return;
    end
end

dir_listing = dir(HURR_path);
dir_files = dir_listing(find([dir_listing(:).isdir]==0)); % eliminate directories from list
HURR_count = 0; % initialize index for counting the number of DIF results files opened
err_count = 0; % initialize index for counting the number of files that give errors
err_file_list{1} = 'Errors were encountered in reading the following file(s):';

for i = 1:length(dir_files)
    filename = dir_files(i).name; 
    if length(filename)<9
        continue;
    elseif ~strcmp(filename(1:4),'file')
        continue;
    elseif ~strcmp(lower(filename(end-3:end)),'.dat')
        continue;
    end
    HURR_struct = readHURRfile( fullfile(HURR_path,filename) );
    if isfield( HURR_struct, 'error')
        err_count = err_count+1;
        err_file_list{err_count+1} = filename;
        continue; % error in reading bldg file
    end
    HURR_count = HURR_count+1;
    HURR_struct_array(HURR_count).label = HURR_struct.label;
    HURR_struct_array(HURR_count).milepost = HURR_struct.milepost;
    HURR_struct_array(HURR_count).recurrence = HURR_struct.recurrence;
    HURR_struct_array(HURR_count).Vsim = HURR_struct.Vsim;
end

err_file_list{length(err_file_list)+1} = ['The selected folder contains ' num2str(HURR_count) ...
    ' valid files containing simulated hurricane wind speeds.'];

if err_count
    err_dlg = errordlg(err_file_list,'Errors encountered reading hurricane files');
    uiwait(err_dlg); return;
end

if HURR_count ==0
    HURR_struct_array(1).error = 1;
else
    milepost_list = [HURR_struct_array.milepost];
    [milepost_list, sort_ind] = sort(milepost_list);
    HURR_struct_array = HURR_struct_array(sort_ind);
end