function [parent_dirs, token] = get_file_info_entry(file_info, file_ind, token_ind)

% Check for out of bounds indices
if (file_ind < 1) || (file_ind > file_info.num_files)
    err = MException('FileInfo:OutOfBounds', ...
                     'Index exceeds file info dimensions');
    throw(err);
end

if nargin < 3
    token_ind = 1;
end

% Find the file
curr_info = file_info;
parent_dirs{1} = curr_info.name;
while file_ind > length(curr_info.file);
    file_ind = file_ind - length(curr_info.file);

    i = 1;
    while file_ind > curr_info.subdir(i).num_files
        file_ind = file_ind - curr_info.subdir(i).num_files;
        i = i + 1;
    end
    curr_info = curr_info.subdir(i);
    parent_dirs{end + 1} = curr_info.name;
end
token = curr_info.file(file_ind).tokens{token_ind};
end

