필터 지우기
필터 지우기

how can i calculate total size of a folder?

조회 수: 35 (최근 30일)
Pradeep Gowda
Pradeep Gowda 2015년 5월 10일
답변: Avnet 2024년 4월 3일
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?

채택된 답변

Walter Roberson
Walter Roberson 2015년 5월 10일
Use this Recursive Directory File Exchange contribution, and add up all the bytes fields.
Note: the meaning if bytes on a directory entry would depend upon your operating system.

추가 답변 (1개)

Avnet
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

카테고리

Help CenterFile Exchange에서 File Operations에 대해 자세히 알아보기

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by