Question Locked

NTBACKUP script

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Hi All,

This is my first post, I also feel that it is worth while mentioning I have very limited scripting abilities.

When I do any type of backup that is scheduled with NTBACKUP I have a choice of either appending or overwriting the job, is it possible to have a script that will (be started by task scheduler) use the command line syntax but (and this is the question) automatically add to the filename.bks the date or some other unique variable so that when the backup job is run every day it will not overwrite any of the previous jobs.

So the backup name could pottentially look like filename_date.bks

I hope this is clear.

Thanks

Troy Thomas
IT & Network Administrator

3 replies

by ddtlestar

User Administrator login:

Save your selection file as {C:\BackupTasks\Daily.bks}

Suppose you are using Data format 'dd/mm/yyyy'...

Create a batch file {C:\BackupTasks\Daily.bat} as follows (two lines):
-----------------------------
set DateString=%Date:~6,4%.%Date:~3,2%.%Date:~0,2%

%WinDir%\system32\ntbackup.exe backup "@C:\BackupTasks\Daily.bks" /n "Backup_%DateString%" /d "Backup_%DateString%" /v:no /r:yes /rs:no /hc:off /m normal /j "Backup_%DateString%" /l:s /f "C:\Backups\Backup_%DateString%.bkf"
-----------------------------

Schedule the batch file to be run by task scheduler. Backups will be saved in C:\Backups\ with filenames like Backup_yyyy.mm.dd.bkf that is sortable by filename.

This discussion is closed to new replies.