File increment in batch file
Posted on 2006-04-20
I'm looking into a batch file for a file backup. It's pretty straight forward, but I know nothing about batch files beyond the basics.
Basically every night I will have a file created called pos.dat
What I'd like to do is increment all previous files by one before placing the dat file while keeping only 100 dat files
Delete previous pos100.dat
rename pos99.dat to pos100.dat
rename pos98.dat to pos99.dat
rename pos97.dat to pos98.dat
rename pos01.dat to pos02.dat
rename previous days pos.dat pos01.dat
create new pos.dat
I know I can do this with a 100+ line batch file, but I did't know if there was a better way to do this with variables.
Thanks for your help!