0

I need assistance with creating a bat or VBSript that will truncate the last 34 characters in the file name then add "HCL" at the end while keeping the file extension. Here is an example: old file SMITH,JOHN_HR 100-110 Hist Certs, Licensures, Education.tif new file SMITH,JOHN_HR 100-110HCL.tif

I have over 1000 files to rename, any assistance will be very grateful.

user2709035
  • 1
  • 1
  • 1

2 Answers2

1
for /f "delims=" %%a in ('dir /b /a-d *.tif') do (
    set "name=%%~na"
    set "ext=%%~xa"
    setlocal enabledelayedexpansion
    set "nname=!name:~0,-34!"
    ren "!name!!ext!" "!nname!HCL!ext!"
    endlocal
)
foxidrive
  • 40,353
  • 10
  • 53
  • 68
Endoro
  • 37,015
  • 8
  • 50
  • 63
0

This method makes some assumptions about the consistency of all original file names, but may work in your case:

ren *"0 Hist Certs, Licensures, Education.tif" *0HCL.tif
chazjn
  • 313
  • 4
  • 18