1.

Solve : Renaming multiple files at once?

Answer»

I would like to rename a large amount of files at once. For EXAMPLE:

I would like to rename all the files beginning with 4REF to 4REF_SL

Old Name New Name
ex: 4REF0001.jpg 4REF_SL0001.jpg
4REF0002.jpg 4REF_SL0002.jpg

I tried using an * but it does not work.... help!

Using WILDCARDS with the ren command can produce some SURPRISING results, and not NECESSARILY good ones. Based on your naming convention, this may help:

Code: [Select]@echo off
setlocal enabledelayedexpansion
for %%v in (*.jpg) do (
set fname=%%v
set ref=!fname:~0,4!
set num=!fname:~4,4!
ren %%v !ref!_SL!num!.jpg
)

You may need to USE a path pointer to the jpg files.

Good luck.



Discussion

No Comment Found