TIP: Click on subject to list as thread! ANSI
echo: batpower
to: All
from: Bruce Howells
date: 2003-03-06 20:35:00
subject: The reason for this eecchhoo...

Howdy All, here's a little BATCH that I put to_get_her recently. It's
intended to be an `auto-increment' file renamer...
 
{at}if (%9)==() goto Begin
set i=
set v=%1
 
:Inc 
shift
if (%i%)==(!) set i=!!
if (%1)==(%t%) set i=%i%!
if not (%i%)==(%r%) goto Inc
set %v%=%1
 
if not (%1)==(0) goto End
if (%v%)==(a) goto End
 
if (%v%)==(c) set t=%b%
if (%v%)==(c) %m% b 0 1 2 3 4 5 6 7 8 9 0
 
set t=%a%
%m% a 0 1 2 3 4 5 6 7 8 9 0
 
goto End
 
:Begin
{at}echo off
set f=packet.
set m=%0
 
for %%n in (0 1 2 3 4 5 6 7 8 9) do if exist %f%%%n?? set a=%%n
 
for %%n in (0 1 2 3 4 5 6 7 8 9) do if exist %f%%a%%%n? set b=%%n
 
for %%n in (0 1 2 3 4 5 6 7 8 9) do if exist %f%%a%%b%%%n set c=%%n
 
set r=!!
set t=%c%
%m% c 0 1 2 3 4 5 6 7 8 9 0
 
:end
echo Next filename %f%%a%%b%%c%
 
for %%v in (a b c f i m r t v) do set %%v=
 
[end of batch]
 
Below the `:Begin' line there is a line which reads `set f=packet.', this
line should be changed to indicate the filename (no extention) that the
batch is to work with. It firstly figures out what the highest value
extention exists in the current directory (using the `packet.' mask), then
increments that number by one, and displays the next file number in the
series.
 
To give it a whirl, create a few tiny files using...
   ECHO !>packet.087
   ECHO !>packet.091
(or similar), and try it out, perhaps. Bruce

---
* Origin: Melbourne PC User Group BBS (3:633/309)
SEEN-BY: 633/267 270
@PATH: 633/309 104 260 774/605 123/500 106/2000 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.