how can i calculate total size of a folder?
26 次查看(过去 30 天)
显示 更早的评论
i'm reading a folder of images , now i wanna display its total size in my GUI. how can i get total size of the folder that i access?
0 个评论
采纳的回答
Walter Roberson
2015-5-10
Note: the meaning if bytes on a directory entry would depend upon your operating system.
0 个评论
更多回答(1 个)
Avnet
2024-4-3
This does the trick:
D = dir('**/*.mat'); % descends current folder and its sub-folders
total_bytes = 0;
for ii = 1:length(D)
total_bytes = total_bytes + D(ii).bytes;
end
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 File Operations 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!