We help IT Professionals succeed at work.

ntbackup batch files

SuprSpy79
SuprSpy79 asked
on
I have an external usb drive to backup a server. I want to make a new file each day for two weeks, and then have it start overwriting the oldest one. I dont think this is possible with the native ntbackup interface but from what I have read it looks like it is possible with a batch file that does the moving and deleting and then letting ntbackup launch from it.

I need to make a single icon on the desktop for the end user (idiot proof) so they can launch the backup and see a message when its done.

Any help would be greatly appreciated
Comment
Watch Question

What is the command you are currently using to create backups?  Also, to be specific, you want a maximum of 14 files (days) stored on the USB drive, correct?

Author

Commented:
well what im doing now is i created a backup using the wizard, and i set it to a date earlier than today so it never runs because the user needs to initiate this backup in the morning.

so I have them open scheduled tasks, right click it and run, but that will only over right, or make one GIANT file.

This is the current string in the scheduled task

C:\WINDOWS\system32\ntbackup.exe backup "@C:\Documents and Settings\Administrator\Local Settings\Application Data\Microsoft\Windows NT\NTBackup\data\MorningBackup.bks" /a /d "Set created 6/7/2007 at 9:38 AM" /v:yes /r:no /rs:no /hc:off /m normal /j "MorningBackup" /l:s /f "E:\Backup.bkf"

Yes Id like to keep an archive of 14 days

Regards
Lee W, MVPTechnology and Business Process Advisor
Most Valuable Expert 2013

Commented:
Give me a day and you might have it - I've had a batch file for running NTBackups posted on my web site for some time.  I'm hoping to modify it today (was working on it last night, but hit a problem I couldn't resolve then) and expect to have an updated version ready that will allow automated deletions based on a set number of weeks to preserve.

You can get the current version - WITHOUT the automated deletions - at http://www.lwcomputing.com/mysoftware.asp

Author

Commented:
great i will keep an eye on it. please post here when its ready.
Lee W, MVPTechnology and Business Process Advisor
Most Valuable Expert 2013

Commented:
No promises - I'm trying to work out the shifting issue - basically, the script would ask you how many weeks you want to save, then on a given day, it would shift Current Week to Week 1, Week 1 to Week 2, Week 2 to Delete and delete the contents of Delete.  But I'm having issues automating this - when I can get them worked out (I have my own open question on this) it should work nicely.

Author

Commented:
could you just check the date on the folders and IF the date is greater than X days away from current date delete it? x being the number of days you want to keep?
Lee W, MVPTechnology and Business Process Advisor
Most Valuable Expert 2013

Commented:
Date checking and comparison is not easy in a batch file for these purposes - it can be done, but it's not easy.  However, I do have my solution and I will be working on the batch file later today.

Author

Commented:
ok let me know, otherwise I know a software guy who could whip up a small exe that you could call to do date checing.
Lee W, MVPTechnology and Business Process Advisor
Most Valuable Expert 2013

Commented:
Ok - I think it's ready.  TEST IT FIRST.  I did some testing myself and I think it's ok, but TEST IT FIRST.
Take a look at BackupAssist (http://www.backupassist.com). It's a very friendly front end to NTBACKUP. It takes care of scheduling and various backup schemes. There is a 30 day free trial. I use it to backup small servers to NAS. It's really very good and not at all expensive.

Author

Commented:
leew, i tried v 1,07 and did not see any options for a backup scheme as far as how many days to keep etc.
Lee W, MVPTechnology and Business Process Advisor
Most Valuable Expert 2013

Commented:
You need 1.1, not 1.07 - in addition, it does it by weeks, not days.

Author

Commented:
ok  will take a look at it again tonight.
I wound up just doing it manually since I couldn't figure it out.