Bat script to rename files -
i have folder many images (jpg format) imported smartphone, , want rename them in team_# # increasing number. want team_1.jpg, team_2.jpg, ...
what did this:
set /a count=1 setlocal enabledelayedexpansion %%j in (*.jpg) ( ren "%%j" "team_!count!.jpg" set /a count=count+1) endlocal
but result quite strange. "misses" number! means example have team_1.jpg, team_2.jpg, ..., team_7.jpg, team_9.jpg skips 8. , if relaunch script, skips number, different one.
i tried removing underscore file name , works ok, need underscore.
any idea? thanks!
try, in place of
for %%j in (*.jpg) (
for /f "delims=" %%j in ('dir /b /a-d *.jpg') (
if you echo ren... instead of ren, just temporarily, batch report required rename, not execute it. remove the echo to perform rename
what believe happening ren
renaming to team_8.jpg, renaming team_8.jpg team_somethingelse.jpg.
the dir
command build list of .jpg
names, then for/f
processes list.
Comments
Post a Comment