linux 下 使用matlab 批量更改文件名

clear;
path='文件路徑';

image_Files = dir(fullfile(path,'/','*.jpg'));
Length = length(image_Files);
for k=1:Length
    oldname=strcat(path,'/',image_Files (k).name);
    newname=strcat(path,'/','A_', num2str(k,'%06d'),'.jpg');
    command = ['mv' 32 oldname 32 newname];
    status = dos(command);
    if status == 0
        disp([oldname, ' 已被重命名爲 ', newname])
    else
        disp([oldname, ' 重命名失敗!'])
    end
end
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章