1.

Solve : Batch file to rename files - help?

Answer» HELLO

I need your help. I have a LOT of files in directory c:\temp shown as below :

c:\temp\test1fit.csv
c:\temp\test2fit.csv
c:\temp\test3fit.csv
c:\temp\test4fit.csv
..............................

I want to rename all this files by cut 'fit' in names. I want to get following results :

c:\temp\test1.csv
c:\temp\test2.csv
c:\temp\test3.csv
c:\temp\test4.csv
..............................

I have no idea how i can do this in batch file I have to do in batch file. PLEASE help me. I will be appreciative.This might help. Store the batch file in any directory you want (does not have to be in c:\temp):

Code: [Select]@echo off
setlocal enabledelayedexpansion

pushd c:\temp

for /f %%i in ('dir /b /a-d *.csv') do (
SET newName=%%i
set newName=!newName:fit=!
ren %%i !newName!
)

popd

Good luck. Quote from: Sidewinder on November 04, 2013, 10:18:57 AM
This might help. Store the batch file in any directory you want (does not have to be in c:\temp):
Thank you very much


Discussion

No Comment Found