How to delete only contents from folder? contents might include folders and files
5 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hi
How to delete only contents from folder? contents might include folders and files
Best Vahid
1 Commento
Azzi Abdelmalek
il 28 Lug 2015
How to delete only contents from folder? Is there anything else then contents?
Risposte (1)
Walter Roberson
il 28 Lug 2015
whichfolder = 'MyFolderName';
dinfo = dir(fullfile(whichfolder,'*.*'));
dinfo(dinfo.isdir) = []; %remove the directories from consideration
for K = 1 : length(dinfo)
thisfile = fullfile(whichfolder, dinfo(K).name);
delete(thisfile);
end
0 Commenti
Vedere anche
Categorie
Scopri di più su Statistics and Machine Learning Toolbox in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!