Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: multi rename

7 views
Skip to first unread message

Herbert Kleebauer

unread,
Jun 6, 2006, 5:48:49 PM6/6/06
to
"BIG (Umberto)" wrote:

> Sorry, w98!

> ren 3278*.ext 4567*.ext work.
>
> The problem is for the different lenght from the original prefix and the new
> prefix.
> I have create a project mamed "co" (2 letters for example), and now I must
> change this whith 4567.

> ren co-*.ext 4567-*.ext
>
> change only the first file, en exit whith duplicate filename error.

If the new prefix is always longer than the old prefix, increase
the old prefix before replacing it with the new prefix:

lfnfor on
for %%i in (co-*.ext) do ren %%i aa%%i
ren aaco-*.ext 4567-*.ext

If the new prefix can also be smaller the the old prefix, remove
the old prefix before inserting the new prefix:

ren ??-*.ext " -*.ext"
lfnfor on
for %%i in (*.ext) do ren "%%i" %%i
for %%i in (*.ext) do ren %%i 4567%%i

Day Brown

unread,
Jun 6, 2006, 9:48:25 PM6/6/06
to
A dos utiltiy, 'COUNT.COM', IIRC, by Horst, mite be useful.
you can increment or decrement any numerical variable.
set SEQUENCE=00
COUNT SEQUENCE
:: increments (the default) by one (the default) variable %SEQUENCE%.
ren FILENAME%SEQUENCE%.EXT NEWNAME%SEQUENCE%.EXT

:: in my batch programs, all batch compiler commands are lower case.
:: all FILENAMES and VARIABLES are uppercase.

0 new messages