필터 지우기
필터 지우기

Help in naming the file from 001 to 100 with the same extenstion

조회 수: 2 (최근 30일)
ken ken
ken ken 2015년 10월 16일
댓글: Jos (10584) 2015년 10월 16일
May i know how to rename all the file with the same extension .jpg(random name) in the same folder to 001.jpg , 002.jpg and so on to 100.jpg etc

채택된 답변

Jos (10584)
Jos (10584) 2015년 10월 16일
편집: Jan 2015년 10월 16일
% assuming you are in the directory of choice
extension = 'jpg'
DF = dir(['*.' extension])
for k = 1:numel(DF)
old_name = DF(k).name
new_name = sprintf('%03d.%s', k, extension)
% movefile(old_name, new_name) % UNCOMMENT WHEN YOU ARE SURE
end
  댓글 수: 4
ken ken
ken ken 2015년 10월 16일
편집: ken ken 2015년 10월 16일
I had solve it thank you
Jos (10584)
Jos (10584) 2015년 10월 16일
Thanks Jan, for the corrections! :-)

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Guillaume
Guillaume 2015년 10월 16일
Option 1: Write a script in matlab, debug it to make sure that it does not result in data loss (like overwriting some files by mistake). As you don't have the confidence to write this code on your own, the debug step will have to be thorough.
Option 2: There are gazillion programs on the internet that let you do batch renaming. Personally, I'd use http://www.irfanview.com/ which also lets you do batch renaming and is a pretty decent image viewer.

카테고리

Help CenterFile Exchange에서 File Operations에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by