Incrementing a batch file by 1

Microsoft Windows 2003 server - 5 users
June 29, 2010 at 08:36:07
Specs: Windows 7
I have the following simple batch file.

MOVE C:\Inetpub\wwwroot\Webfile1\Reminders\Doug_Ancil\doug.csv C:\Inetpub\wwwroot\Webfile1\Reminders\Doug_Ancil\Archive_Data\doug.csv

What I'd like the program to do is that when it moves the file, it adds a numeric value after the file name so the file would be doug1.csv and so forth. Can anyone offer a solution to this?



See More: Incrementing a batch file by 1

Report •

June 29, 2010 at 16:40:08
@echo off & setlocal
pushd C:\Inetpub\wwwroot\Webfile1\Reminders\Doug_Ancil\Archive_Data\doug.csv
for /f %%a in ('dir /b /a-d doug*.csv ^|find /v /c ""') do move c:\Inetpub\wwwroot\Webfile1\Reminders\Doug_Ancil\doug.csv .\doug%%a.csv
::---- end

Report •

June 29, 2010 at 17:27:54
Nice! Essentially 2 lines of code (excluding the
@ECHO/SETLOCAL and ending comment). What's better than
that?! :-D

Insomniac at large

Report •

Related Solutions

Ask Question