wirthr
asked on
NTBackup Filenames
Does anyone have a solution to this problem? You can't use wildcards in filenames for NTBackup. I am backup up to disk using NTBackup, but if I can't use wildcards for the filename, it will just overwrite. Is there anyway to get around this? I was thinking there might be a possiblity of creating a batch script that calls the for the date, and uses that to create another batch script that executes the backup...any ideas? Thanks,
ASKER
Ok, so here is the batch script I am using
@echo off
rem Batch file for monday backups
rem to be scheduled through Nt's AT command
rem
rem this line is to put todays date with -'s into an environ variable
rem to then be inserted into the tape set label text
for /f "tokens=1,2,3 delims=/" %%a in ('date /t') do set today=%%a-%%b-%%c
echo Backup Script - PDC - Full - by...(11-25-98)
echo .
ntbackup backup "@C:\Documents and Settings\Administrator.ADA MSASSOCIAT ES\Local Settings\Application Data\Microsoft\Windows NT\NTBackup\data\Monday Backup 5.bks" /a /v:yes /J "Full Backup for %today% /m normal /hc:off /l:s /t normal /f "f:\%today%"
echo Tape Set: Monday Full BU %today%
echo Backup Done
and in the log file I get
Invalid command line parameter 'f:\Fri'.
any idea why?
Thanks,
@echo off
rem Batch file for monday backups
rem to be scheduled through Nt's AT command
rem
rem this line is to put todays date with -'s into an environ variable
rem to then be inserted into the tape set label text
for /f "tokens=1,2,3 delims=/" %%a in ('date /t') do set today=%%a-%%b-%%c
echo Backup Script - PDC - Full - by...(11-25-98)
echo .
ntbackup backup "@C:\Documents and Settings\Administrator.ADA
echo Tape Set: Monday Full BU %today%
echo Backup Done
and in the log file I get
Invalid command line parameter 'f:\Fri'.
any idea why?
Thanks,
Can you try adding the .bkf to the "f:\%today%"? It looks as it replaces the %today% correctly...
ASKER
same error
Invalid command line parameter 'f:\Fri'.
Invalid command line parameter 'f:\Fri'.
Try it this way, the example is streamlined for tapes:
@echo off
rem Batch file for monday backups
rem to be scheduled through Nt's AT command
rem
rem this line is to put todays date with -'s into an environ variable
rem to then be inserted into the tape set label text
for /f "tokens=1,2,3 delims=/" %%a in ('date /t') do set today=%%a.bkf
echo Backup Script - PDC - Full - by...(11-25-98)
echo .
ntbackup backup "C:\Documents and Settings\Administrator.ADA MSASSOCIAT ES\Local Settings\Application Data" /J "Full Backup for %today%" /l:f /f "f:\%today%"
echo Tape Set: Monday Full BU %today%
echo Backup Done
@echo off
rem Batch file for monday backups
rem to be scheduled through Nt's AT command
rem
rem this line is to put todays date with -'s into an environ variable
rem to then be inserted into the tape set label text
for /f "tokens=1,2,3 delims=/" %%a in ('date /t') do set today=%%a.bkf
echo Backup Script - PDC - Full - by...(11-25-98)
echo .
ntbackup backup "C:\Documents and Settings\Administrator.ADA
echo Tape Set: Monday Full BU %today%
echo Backup Done
ASKER
This is what I did, and should be posted as one of the "time tested solutions". Works great. In scheduler, I just scheduled the event for each day of the week, the only thing that needs added is the destination drive letter. If you want the backup to go to drive F:\, just run
SetBackup.bat F
works perfect
@echo off
REM ========================== ========== ========== ========== ======
REM Options: SetBackup <Drive Letter>
REM Example: SetBackup F
REM ========================== ========== ========== ========== ======
REM Batch file for monday backups
REM Written by the good guys at smbizhost.com
REM ========================== ========== ========== ========== ======
FOR /F "tokens=1,2 delims= " %%F IN ('date /t') Do Set tmpDate=%%G
FOR /F "tokens=1,2,3 delims=/" %%F IN ("%tmpDate%") Do Set tmpDate=%%F-%%G-%%H
ntbackup backup "@C:\Documents and Settings\userdir\Local Settings\Application Data\Microsoft\Windows NT\NTBackup\data\Backup.bk s" /a /v:yes /J "Full Backup for %tmpDate%" /m normal /hc:off /l:f /f "%1:\%tmpDate%.bkf"
It should be noted that the backup.bks file needs to be created using ntbackup. make the selections of what you want backed up and click on job, and then save as. Then change the following to represent the location of your .bks file.
ntbackup backup "@C:\Documents and Settings\userdir\Local Settings\Application Data\Microsoft\Windows NT\NTBackup\data\Backup.bk s"
Thats it!
Thanks,
SetBackup.bat F
works perfect
@echo off
REM ==========================
REM Options: SetBackup <Drive Letter>
REM Example: SetBackup F
REM ==========================
REM Batch file for monday backups
REM Written by the good guys at smbizhost.com
REM ==========================
FOR /F "tokens=1,2 delims= " %%F IN ('date /t') Do Set tmpDate=%%G
FOR /F "tokens=1,2,3 delims=/" %%F IN ("%tmpDate%") Do Set tmpDate=%%F-%%G-%%H
ntbackup backup "@C:\Documents and Settings\userdir\Local Settings\Application Data\Microsoft\Windows NT\NTBackup\data\Backup.bk
It should be noted that the backup.bks file needs to be created using ntbackup. make the selections of what you want backed up and click on job, and then save as. Then change the following to represent the location of your .bks file.
ntbackup backup "@C:\Documents and Settings\userdir\Local Settings\Application Data\Microsoft\Windows NT\NTBackup\data\Backup.bk
Thats it!
Thanks,
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
https://www.experts-exchange.com/questions/20938772/How-can-I-make-a-daily-First-in-First-out-backup-using-ntbackup.html
or this:
https://www.experts-exchange.com/questions/10101935/Insert-Date-in-a-Batch-file.html