Source_dir='E:\face_data\明星图\30_fresh_meat';
files = dir(Source_dir);
sub_len=length(files);
for i=1:sub_len
subname=files(i).name;
if(strcmp( subname,'.'))
continue;
end
if(strcmp( subname,'..'))
continue;
end
sub_path=fullfile(Source_dir,subname);
DIR_b=dir(sub_path)
for jj=1:length(DIR_b)
oldname= DIR_b(jj).name;
if(strcmp(oldname,'.'))
continue;
end
if(strcmp(oldname,'..'))
continue;
end
newname=strcat(subname, '_',num2str(jj),'.jpg');
realName=fullfile(Source_dir,subname,oldname);
changeName=fullfile(Source_dir,subname,newname);
movefile(realName,changeName);
end
end
批量修改图像命名方式
最新推荐文章于 2023-03-04 20:38:39 发布