Solved batch rename files based on txt content

April 10, 2012 at 04:45:30
Specs: Windows 7
Hi,
I want to create batch to rename the files based on context of text file.
the text file contains like the following:
current_name1.jpg|new_name1.jpg
current_name2.jpg|new+name2.jpg

I want to loop and find the current name in the directory and rename it to the new name in txt file.

is there any way to do it?
i'm working in windows server 2003.


Thanks


See More: batch rename files based on txt content

Report •

#1
April 10, 2012 at 06:12:54
✔ Best Answer
@echo off
for /f "tokens=1,2 delims=|" %%a in (
'type your_file.txt'
) do (
if exist "%%a" echo ren "%%a" "%%b"
)

If the output looks correct, remove the echo.

Tony


Report •

#2
April 10, 2012 at 07:55:22
YES, it worked,

Thank you very much, I just removed the single quotes from the file name.

That will save my time totally.


Regards


Report •
Related Solutions


Ask Question