Computing.Net > Forums > Programming > Rename batch file

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Rename batch file

Reply to Message Icon

Name: apsley191
Date: February 23, 2009 at 13:53:18 Pacific
OS: Windows XP
Subcategory: Batch
Comment:

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

Thanks
Helena



Sponsored Link
Ads by Google

Response Number 1
Name: IVO
Date: February 23, 2009 at 14:49:21 Pacific
Reply:

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
  )
  popd
)
:: End_OF_Batch


0

Response Number 2
Name: apsley191
Date: February 23, 2009 at 19:12:27 Pacific
Reply:

thanks heaps - worked exactly how I wanted!!!


Cheers
Helena


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Rename batch file

Copy and Rename Batch File www.computing.net/answers/programming/copy-and-rename-batch-file/15297.html

Renaming batch files www.computing.net/answers/programming/renaming-batch-files/15207.html

Batch file renaming www.computing.net/answers/programming/batch-file-renaming/8204.html