You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: getfilenames.m
    path of file: ./repos/Image-Harmonization-Dataset-iHarmony4/Lalonde and Efros/utils/mycode/files
    
    the code of the file until where you have to start completion: function files = getfilenames(path, pattern, fullpath, recurse)
% Return cell array of files matching the pattern at the specified path.
% 
%   files = getfilenames(basePath, <pattern>, <fullpath>, <recurse>)
%
%   'pattern': pattern to be matched. The special case of 'images' will find 

    
function files = getfilenames(path, pattern, fullpath, recurse)
% Return cell array of files matching the pattern at the specified path.
% 
%   files = getfilenames(basePath, <pattern>, <fullpath>, <recurse>)
%
%   'pattern': pattern to be matched. The special case of 'images' will find 
%   all image types in the input directory.
% 
%   'fullpath': boolean (defaults to false). When 'true', returns the full
%   path for each file.
%
%   'recurse': integer which specifies the number of times we have to
%   recurse into sub-directories. Set to 'Inf' to recurse the entire
%   directory tree.
%   
% 
% ----------
% Jean-Francois Lalonde

if nargin < 2
    pattern = '';
end