I want to create a bat file to create backup of a file. Bat file will get the file as parameter and then it will create a backup by copying it with a different name.
For Example
mybat.bat index.asp
will create index_1.asp
I did this. But the problem is that I want to have a check system while copying file.
if index_1.asp exists then it will create index_2.asp instead of index_1.asp
And the index will increase until the file not exists. I did something but
IF NOT EXISTS always gives me error.
THX FOR HELP.
Backup File
Moderator: DosItHelp
Re: Backup File
See as done it in this batch http://forum.wincmd.ru/viewpost.php?p=62933
It is invoked as: addcnt.cmd "list of files & dirs" "d:\folder 4 backups\"
File format "list of files & dirs" is:
Batch conveniently used in conjunction with "Total Commander" filemanager, which sends the list of selected items in this format as a parameter %L. "D:\folder 4 backups\" can be omitted.
Command "&chcp 1251> nul" you probably do not need, remove it.
The report indicates:
It is invoked as: addcnt.cmd "list of files & dirs" "d:\folder 4 backups\"
File format "list of files & dirs" is:
Code: Select all
c:\path\name.txt
c:\long path\long name.txt
c:\folder\
c:\and folder too\
Batch conveniently used in conjunction with "Total Commander" filemanager, which sends the list of selected items in this format as a parameter %L. "D:\folder 4 backups\" can be omitted.
Command "&chcp 1251> nul" you probably do not need, remove it.
The report indicates:
echo 9999 units in the destination,
echo insufficient bits of counter.