The most important improvement would be a documentation: The first comment section after the "function ..." line is displayed by the "help" command. Without a documentation, which explains e.g. the type and dimensions of inputs and outputs as well as the applied procedure, a function is not usable, although it might be useful.
Look at Matlab's toolbox functions to learn more about the usual documentation style, e.g. the "H1-line".
This is a great function, but has a major limitation due to its use of dir.m
str = 'C:\myFolder';
myFiles1 = fuf(str, 1,'detail');
Folder = [str '\']; %can be a relative path
jFile = java.io.File(Folder); %java file object
%Names_Only = cellstr(char(jFile.list)); %cellstr
myFiles2 = arrayfun(@char,jFile.listFiles,'un',0); %cellstr.
When the data is large in size (eg >1E5 files) or held on a network (eg cloud platform) then dir.m and hence fuf.m will fail. Use the second method to get around this:)