フィルターのクリア

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 Center および File ExchangeFile Operations についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by