How to delete only contents from folder? contents might include folders and files
4 ビュー (過去 30 日間)
古いコメントを表示
Hi
How to delete only contents from folder? contents might include folders and files
Best Vahid
1 件のコメント
Azzi Abdelmalek
2015 年 7 月 28 日
How to delete only contents from folder? Is there anything else then contents?
回答 (1 件)
Walter Roberson
2015 年 7 月 28 日
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 件のコメント
参考
カテゴリ
Help Center および File Exchange で Statistics and Machine Learning Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!