Delete files with specific sizes
13 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponse acceptée
Bhaskar R
le 14 Fév 2020
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 commentaires
Bhaskar R
le 15 Fév 2020
You can learn/refer MATLAB fundamentals to apply solution to your problem. MATLAB provides very rich documentation clearly.
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur File Operations dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!