Delete files inside subfolder
37 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Nik Rocky
le 26 Juin 2020
Commenté : Nik Rocky
le 26 Juin 2020
Hello,
I have a folder:
Testfolder
Inside are:
1.mat
1.txt
1.wav
SubTestfolder
Inside SubTestfolder are:
2.mat
2.txt
2.wav
I do
Del_path = fullfile(TestFolderPath,SubTestFoldername);
delete(Del_path,'*.mat')
I was waiting that 2.mat should be deleted, but it will be 1.mat deleted, not 2.mat. Why? How can I delete files/all files in subfolder?
Thank you!
0 commentaires
Réponse acceptée
Fangjun Jiang
le 26 Juin 2020
use dir('**/*.mat') to find files in subfolders in one shot and then use a for-loop to delete the files.
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Tables 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!