how can i calculate total size of a folder?
10 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Pradeep Gowda
il 10 Mag 2015
Commentato: SOMNATH BAKSI
il 10 Dic 2024
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 Commento
SOMNATH BAKSI
il 10 Dic 2024
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
Risposta accettata
Walter Roberson
il 10 Mag 2015
Note: the meaning if bytes on a directory entry would depend upon your operating system.
0 Commenti
Più risposte (1)
Tria
il 3 Apr 2024
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 Commenti
Vedere anche
Categorie
Scopri di più su File Operations in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!