Reputation: 962
I am trying to batch rename several files that are named using the following scheme: picture.scn_xxx.png
.
xxx
a numerical value ranging from 00000001
to
(possibly) 99999999
..scn
to just have picturexxx.png
.I've tried the following in command:
ren picture.scn_*.png image*.png
However, this does not give me the desired result, I get image.scn_xxx.png
instead. The .scn
isn't removed( I was hoping to get imagexxx.png
)
Upvotes: 0
Views: 117
Reputation: 130839
for /f "tokens=1* delims=_" %A in ('dir /b /a-d "picture.scn_*.png"') do ren "picture.scn_%B" "picture%B"
If used in a batch file then %A
and %B
must change to %%A
and %%B
Upvotes: 1