how can i calculate total size of a folder?
13 ビュー (過去 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?
1 件のコメント
SOMNATH BAKSI
2024 年 12 月 10 日
SubFolder = dir(fullfile(app.datasetFolder,'*'));
folderSize = setdiff({SubFolder([SubFolder.isdir]).name},{'.','..'});
if(size(folderSize,2) == 0)
errordlg('Folder does not have any data');
else
disp(folderSize)
end
採用された回答
Walter Roberson
2015 年 5 月 10 日
Note: the meaning if bytes on a directory entry would depend upon your operating system.
0 件のコメント
その他の回答 (1 件)
Tria
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!