MATLAB: How to delete empty files/spreadsheets in a directory

commanddatadeletedirectoryemptyMATLABremovexlsx

Hello,
I have a directory with milions of .xlsx files. The point is that I want to remove empty files. Is there a way to do it using a command in matlab? Instead of the fact that these files are empty, they have 10kb.
Could you please help me?

Best Answer

After your suggestions I wrote finally this script that works
clc
clear
% C = readcell('EMPTY.xlsx');
% isempty(C)
emptyfiles=dir('*xlsx')
for k=1:numel(emptyfiles)
emptynew=emptyfiles(k).name
[STATUS, SHEETS] = xlsfinfo(emptynew);
% if length(SHEETS) > 1; next; end %assume multiple sheet files are special
C = readcell(emptynew, 'sheet', SHEETS{1});
if isempty(C);
delete(emptynew);
end
end