Batch script to rename files

karthikrm February 9, 2009 at 11:37:18
Specs: Windows XP
Hi,

i want to rename all the files in my directory by stripping out the first 3 chars of the file. My files are of the type

C:\01 file1.jpg
C:\02 file2.jpg

I want to change them to

C:\file1.jpg
C:\file2.jpg.

Any pointers on how to write a DOS batch script to do this?

thanks in adance.


See More: Batch script to rename files

Report •


#1
February 9, 2009 at 12:33:19
:: MYREN.BAT  Usage: myren Folder_Name
@echo off & setlocal EnableDelayedExpansion
pushd %*
for /F "delims=" %%j in ('dir /B *.jpg') do (
  set file=%%j
  ren "%%j" "!file:~3!"
)
popd
:: End_Of_Batch


Report •

#2
February 9, 2009 at 12:34:24
If you don't get a helpful reply quickly you can private message a computing.net member who goes under the name: Mechanix2Go

He's one of the best DOS based batchfilers I've ever met.


Report •

#3
February 9, 2009 at 12:35:42
This question has been asked countless times, just do a search for Rename Files


Report •

Related Solutions


Ask Question