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:)