File Exchange

image thumbnail

File List

version 1.0.0.0 (2.72 KB) by Jed F.
File list builds a list of files for use in batch processing.

6 Downloads

Updated 29 Jan 2009

View License

File list builds a list of files for use in batch processing. The user can select the sub-folder depth for recursion, file extensions to search for, and file name to search.

It is helpful for batch processing large number of files in various folders or sub folders.

[files,total]=file_list(pwd,'*.mat',1);
for i=1:total
data=load(files{i});
% Do stuff with data
end

Cite As

Jed F. (2020). File List (https://www.mathworks.com/matlabcentral/fileexchange/22829-file-list), MATLAB Central File Exchange. Retrieved .

Comments and Ratings (1)

Nice work on this Jed - one thing to consider adding....

Replace line 134

temp_file_list = dir(folder);

with

temp_file_listA = dir([folder '\*' file_extension ]);

temp_file_listB = dir([folder '\*.']);

temp_file_list = [temp_file_listA;temp_file_listB];

This can improve speed substantially (10x)

MATLAB Release Compatibility
Created with R14
Compatible with any release
Platform Compatibility
Windows macOS Linux