0

So you want to partially rename loads of files, keep the names intact, and you just want to use a batch file

by Jon 12. October 2010 14:36

So you have a load of files containing the same word which all need to be replaced with another word.  You could buy some software or just use this batch file:

Create a Batch File Called Replace.bat in the folder containing the files you want to rename

@echo off

setlocal

set /p Srch=Text in filename to find:

set /p Repl=Text to replace "%Srch%" with:

echo Searching for filenames containing "%Srch%" and replacing with "%Repl%" ...

for /f "tokens=*" %%a in ('dir /b *%Srch%*') do call :Replace "%%a"      

goto :EOF

:Replace

set x=%1

call set x=%%x:%Srch%=%Repl%%%

ren %1 %x%

Double Click on the Batch File Enter the File Text you want to replace, and the new text

Rename with a Batch Script

And the files are renamed as you expect

Rename Complete

It feels a little old school but hey it works on all pcs without needing to install anything and thats exactly what you need in situations where you need to rename lots of files at the same time

Tags:

Batch | Maintanance

Add comment




  Country flag
biuquote
  • Comment
  • Preview
Loading


Powered by BlogEngine.NET 2.0.0.36
Original Design by Laptop Geek, Adapted by onesoft, and finally some tiny tweaks by JonAlb