Rename batch file

February 23, 2009 at 13:53:18
Specs: Windows XP
Hi - I'm hoping that someone out there can help. I have approx 200 folders each with a series of files called Tasveg; ie each folder contains Tasveg.shp, Tasveg.dbf, Tasveg.shx etc.

What I need to do is rename each set of files with a unique identifier eg
Folder A containc TasvegA.shp, TasvegA.dbf, TasvegA.shx etc
Folder B contains TasvegB.shp, TasvegB.dbf, TasvegB.shx etc
Folder C contains TasvegC.shp, TasvegC.dbf, TasvegC.shx etc


See More: Rename batch file

Report •

February 23, 2009 at 14:49:21
BEWARE: batch not tested

:: TASVEG.BAT  Usage: tasveg
@echo off & setlocal EnableDelayedExpansion
set cnt=0
for /D %%i in (*) do (
  set /A cnt+=1
  pushd "%%i"
  for %%j in (Tasveg.*) do (
    ren %%j %%~nj-!cnt!%%~xj
:: End_OF_Batch

Report •

February 23, 2009 at 19:12:27
thanks heaps - worked exactly how I wanted!!!


Report •

Related Solutions

Ask Question