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!