matlab 遍历文件夹是否为空并输出空文件夹名字

 

clc;clear;close all;
path = 'D:\qcc\HDmap_statistics_opendrive\python_code\33782125\xodr_file_continuously_update\';%文件夹目录
fileinfo = dir(path);%获取所有子文件夹
for i=3:length(fileinfo)
    %subfileinfo = dir([path,'\',fileinfo(i).name]);
    subfileinfo = dir(fullfile(path,fileinfo(i).name));%获取子文件夹的信息
    if length(subfileinfo) == 2%判断是否为空,因为matlab有.和..,所以空文件夹的信息长度为2
        disp(fileinfo(i).name);
    end
end

 

https://blog.csdn.net/m0_37052320/article/details/79155944

posted on 2020-07-10 14:11  一杯明月  阅读(745)  评论(0)    收藏  举报