Jump to content

Recommended Posts

Posted

hello,

what i need is help with making a batch file that automaticly back up my work i know how to do this and how to make the folder the backed up work will go in to, BUT the bit i am having trouble with is i need a script that will rename or make a folder with the current date.

any will will be appreciated.

thank you

Posted

cd E:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Backup\

 

SET _day=%date:~0,2%

 

SET _month=%date:~3,2%

 

SET _year=%date:~6,6%

 

SET date=%_day%%_month%%_year%

 

copy wbls m:\eclipsebackups\wbls-%date%

 

i wrote that to get around the fact that date /t contains /'s which are invalid in folder names (yeah, way to go M$)

 

hope that works for you

Posted

My manual backup of SIMS goes something like this:

 

REM *** Backs up the SIMS Databases ***

 

DBATTACH /DATABASE=sims /backup /auto /user=******** /password=************** /SERVER=sims\sims_db

 

REM *** Copies the Docstorage Folder ***

REM *** Setdate creates a folder structure with the current date as the folder name

 

setdate.exe yyyymmdd

call setinto.bat date

 

xcopy d:\sims\sims\docstorage\*.* "D:\Sims\Microsoft SQL Server\MSSQL.1\MSSQL\Backup\Docstorage\%date%\" /e /y

 

xcopy d:\sims\sims\fmssql\db\sims.db "D:\Sims\Microsoft SQL Server\MSSQL.1\MSSQL\Backup\FMS\DB\%date%\" /y

 

xcopy d:\sims\sims\fmssql\db\sims.log "D:\Sims\Microsoft SQL Server\MSSQL.1\MSSQL\Backup\FMS\DB\%date%\" /y

 

xcopy d:\sims\sims\fmssql\db2\sims.db "D:\Sims\Microsoft SQL Server\MSSQL.1\MSSQL\Backup\FMS\DB2\%date%\" /y

 

xcopy d:\sims\sims\fmssql\db2\sims.log "D:\Sims\Microsoft SQL Server\MSSQL.1\MSSQL\Backup\FMS\DB2\%date%\" /y

 

del setinto.bat

 

... and uses setdate .exe to set the variables.

 

Can't remember where I got setdate from now so I can't credit it.

 

Hope this helps

 

HBJB

setdate.zip

  • Thanks 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...