rename multiple files with shorter name

  • Thread starter Thread starter Charles T
  • Start date Start date
C

Charles T

Greetings Group,
I want to rename multiple files in a folder, but
shortening their names in the process, e.g.
from ABCD0064.csv to p064.csv
from ABCD0123.csv to p123.csv
from ABCD0256.csv to p256.csv
That is the last three characters (and extension) to
remain unchanged.
I've tried wild cards to no avail. Any assistance
gratefully received, as I've got 267 files (so far) to
rename.
Thanks and Regards all.
 
Charles T said:
Greetings Group,
I want to rename multiple files in a folder, but
shortening their names in the process, e.g.
from ABCD0064.csv to p064.csv
from ABCD0123.csv to p123.csv
from ABCD0256.csv to p256.csv
That is the last three characters (and extension) to
remain unchanged.
I've tried wild cards to no avail. Any assistance
gratefully received, as I've got 267 files (so far) to
rename.
Thanks and Regards all.

Hello Charles,
this batch requires w2k/xp.

::RenCSV.cmd:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
@echo off
setlocal
For %%A in (ABCD*.CSV) do call :sub "%%~A"
goto :eof
:sub
set Name=%~n1
echo ren %1 "p%Name:~-3%.csv
::RenCSV.cmd:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

if the output seems ok remove the echo in the last line.
 
Thank you Matthias
-----Original Message-----


Hello Charles,
this batch requires w2k/xp.

::RenCSV.cmd:::::::::::::::::::::::::::::::::::::::::::::: :::::::::::::
@echo off
setlocal
For %%A in (ABCD*.CSV) do call :sub "%%~A"
goto :eof
:sub
set Name=%~n1
echo ren %1 "p%Name:~-3%.csv
::RenCSV.cmd:::::::::::::::::::::::::::::::::::::::::::::: :::::::::::::

if the output seems ok remove the echo in the last line.
--
Greetings
Matthias________________________________________
For help on nt commands enter in a cmd window:
W2K>HH windows.chm::ntcmds.htm XP>HH ntcmds.chm
.
 
Back
Top