CareConnect
asked on
Making a .bat file to run by weekly for a backups
I would like to create an automatic batch file that run every 2 weeks it's a "BlackBerryDbBackup.exe" application for backing up a Blackberry server database and then transfer the ".bak" to an network shared folder and then "Veritas" would back it up again on tape.
Can I also have in the .bat file a “delete previous file” when running?...
The problem is that the backup file created doses not have the same name once the utility that does the backup run’s.
If the two weeks automatic back up can not be integrated in the .bat file, i can use the schedule task to run every two weeks as well.
C:\Program Files\Research In Motion\BlackBerry Enterprise Server\Utility> BlackBerryDbBackup -d BESMgmt -f C:\DB_backup_folder –E <-- this currently works fine in .dos (CMD)... How ever it's manual and back's it up on the "C:\" locally.. i want it to copy it to a share drive on an other server ex: \\server\shared and if possible override or delete the previous .bak on the same token.
I hope this was well detailed any help would be great.
Thank you
Can I also have in the .bat file a “delete previous file” when running?...
The problem is that the backup file created doses not have the same name once the utility that does the backup run’s.
If the two weeks automatic back up can not be integrated in the .bat file, i can use the schedule task to run every two weeks as well.
C:\Program Files\Research In Motion\BlackBerry Enterprise Server\Utility> BlackBerryDbBackup -d BESMgmt -f C:\DB_backup_folder –E <-- this currently works fine in .dos (CMD)... How ever it's manual and back's it up on the "C:\" locally.. i want it to copy it to a share drive on an other server ex: \\server\shared and if possible override or delete the previous .bak on the same token.
I hope this was well detailed any help would be great.
Thank you
ASKER
Hi Harris,
Yeah actaly i did and that worked.. but i have to put it in the root of where the utilitly is.. that 's ok
all previous .bak are name with date and time spamp.bak ex" 2006052611321.bak" year, month, day, hour, minute, second.. i am not sure the bat can delete that way the old one if it never has a same name?
Cheers
Yeah actaly i did and that worked.. but i have to put it in the root of where the utilitly is.. that 's ok
all previous .bak are name with date and time spamp.bak ex" 2006052611321.bak" year, month, day, hour, minute, second.. i am not sure the bat can delete that way the old one if it never has a same name?
Cheers
Hi CareConnect,
If you do not wish to use scripting language then a little trick is possible.
::rename all backups to something unique
ren *.bak *.~bk
::run the program
BlackBerryDbBackup -d BESMgmt -f \\server\shared –E
::ok, the program created its own .bak file right?
::but then, we renamed previous .bak files to .~bk =)
::so now we can delete them =)
del *.~bk
OR
::why cant we just do a
del *.bak
BlackBerryDbBackup -d BESMgmt -f \\server\shared –E
hec",)
If you do not wish to use scripting language then a little trick is possible.
::rename all backups to something unique
ren *.bak *.~bk
::run the program
BlackBerryDbBackup -d BESMgmt -f \\server\shared –E
::ok, the program created its own .bak file right?
::but then, we renamed previous .bak files to .~bk =)
::so now we can delete them =)
del *.~bk
OR
::why cant we just do a
del *.bak
BlackBerryDbBackup -d BESMgmt -f \\server\shared –E
hec",)
ASKER
Hi Hec, this is the comand
BlackBerryDbBackup -d BESMgmt -f \\shared\Home$\folder -E
del *.bak \\shared\Home$\folder
Works BUT... it promps you to:
"Could not find c:\program files\research in motion\blackberry enterprise server\utility\*.bak"
then a question: "*, are u sure (Y/N)?
then when i click Yes, it totaly empty the folder on the \\share and does not delete the previous .bak and dosent create a new .bak
Thank
BlackBerryDbBackup -d BESMgmt -f \\shared\Home$\folder -E
del *.bak \\shared\Home$\folder
Works BUT... it promps you to:
"Could not find c:\program files\research in motion\blackberry enterprise server\utility\*.bak"
then a question: "*, are u sure (Y/N)?
then when i click Yes, it totaly empty the folder on the \\share and does not delete the previous .bak and dosent create a new .bak
Thank
oopps... try this
BlackBerryDbBackup -d BESMgmt -f \\shared\Home$\folder -E
del /Q /F \\shared\Home$\folder\*.ba k
/P Prompts for confirmation before deleting each file.
/F Force deleting of read-only files.
/S Delete specified files from all subdirectories.
/Q Quiet mode, do not ask if ok to delete on global wildcard
/A Selects files to delete based on attributes
BlackBerryDbBackup -d BESMgmt -f \\shared\Home$\folder -E
del /Q /F \\shared\Home$\folder\*.ba
/P Prompts for confirmation before deleting each file.
/F Force deleting of read-only files.
/S Delete specified files from all subdirectories.
/Q Quiet mode, do not ask if ok to delete on global wildcard
/A Selects files to delete based on attributes
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi Harris, it finaly worked.
I had to reverse the order of the lines other wise it would of delete all the .bak in that folder.
Thank you!
del /Q/F \\shared\Home$\folder\*.ba k
BlackBerryDbBackup -d BESMgmt -f \\sharedr\Home$\folder -E
I had to reverse the order of the lines other wise it would of delete all the .bak in that folder.
Thank you!
del /Q/F \\shared\Home$\folder\*.ba
BlackBerryDbBackup -d BESMgmt -f \\sharedr\Home$\folder -E
what is the name of the previous .bak?
hec",)