Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Incramenting Counter

Status
Not open for further replies.

Yardyy

Technical User
Aug 13, 2002
448
GB
Hi, Not sure if this the right forum for this or not, but here goes. I have a batch file that renames a file, ideally want i want is for the script to run periodically, and increment the number in the file name each time.

Currently i have a file called, HaCA.tvs and require backups taken of it throughout the day.

what i have now is the following code..

copy /B /Y HaCA.tvs "C:\BKUPS\Backup_00%1_HaCA.tvs"

so when i run the argument 2 it renames the files as Backup_002_HaCA.tvs and so on.

would it be possible for the script to increment by itself, and would then check if Backup_002_HaCA.tvs exists, if so then it would increment the number to Backup_003_HaCA.tvs





Many Thanks
Yurov Ardyy
 
Hi

That is not Unix, but DOS/Windows.

Unless you install CygWin your question is off-topic here.

But a quick help anyway : If you use a newer Windows version which have cmd.exe, type [tt]help set[/tt] in its command line. That will give you a hint about incrementing.

For more, search for a DOS/Windows forum, matching your operating system.

Feherke.
 
Sorry for the post, but thanks for the hint anyway.

Many Thanks
Yurov Ardyy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top