How to delete only contents from folder? contents might include folders and files
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi
How to delete only contents from folder? contents might include folders and files
Best Vahid
1 Kommentar
Azzi Abdelmalek
am 28 Jul. 2015
How to delete only contents from folder? Is there anything else then contents?
Antworten (1)
Walter Roberson
am 28 Jul. 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 Kommentare
Siehe auch
Kategorien
Mehr zu Statistics and Machine Learning Toolbox finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!