Matlab实现批量修改文件名

files = dir('*.xml');
len=length(files);
for i=1:len
    oldname=files(i).name;
    newname=strcat(num2str(i+300), '.xml');
    command = ['rename' 32 oldname 32 newname];
    status = dos(command);
    if status == 0
        disp([oldname, ' 已被重命名为 ', newname])
    else
        disp([oldname, ' 重命名失败!'])
    end
end

猜你喜欢

转载自blog.csdn.net/qq_29462849/article/details/83412956