Delete files with specific sizes
5 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
采纳的回答
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 个评论
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 Exchange 中查找有关 File Operations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!