Delete files with specific sizes

5 ビュー (過去 30 日間)
Oktavian Jason
Oktavian Jason 2020 年 2 月 14 日
コメント済み: Bhaskar R 2020 年 2 月 15 日
Hello everyone,
I want to ask a question.
I have a directory of flight data files and I want to delete some files that have less size than, for example 500 kb.
Is there any way to do it in loop?
Thanks

採用された回答

Bhaskar R
Bhaskar R 2020 年 2 月 14 日
Get the directory files
files = dir('your directory');
Apply loop and delete with your condition
for ii = 1:length(files)
if files(ii).bytes<500000 % 500kb
delete(fullfile(files(ii).folder, files(ii).name)
end
end
  5 件のコメント
Oktavian Jason
Oktavian Jason 2020 年 2 月 14 日
actually i'm a bit confused how to use these. (i'm new to matlab).
can you please give me the example?
let's say my folder is "Project" in D drive, and the folder has about 600 files.
Bhaskar R
Bhaskar R 2020 年 2 月 15 日
You can learn/refer MATLAB fundamentals to apply solution to your problem. MATLAB provides very rich documentation clearly.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeFile Operations についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by