MATLAB: Renaming the image files

renaming the image file

I have more than hundred pictures and i want to rename them..
old name : 1_new, 2_new…… new name : tour1_pictures, tour2_pictures,…….

Best Answer

1. Get the Files in the directory... ([~,ListofImages]=dos('dir /b /s te_*.jpg');)
2. Get the Number from it..(1, 2, etc) (RegExFileName = '[0-9]+_new'; [~,StartIdx]=regexpi(FileName, RegExFileName , 'match');)
3. Format New Name, (NewFileName=['tour',num2str(index),'_pictures'])
4 do a movefile to rename.. movefile(SourceFileName, NewFileName);