+ Post New Thread
Results 1 to 3 of 3
Scripts Thread, create a folder with dates, in Coding and Web Development; hello, what i need is help with making a batch file that automaticly back up my work i know how ...
  1. #1
    sharkster's Avatar
    Join Date
    Nov 2007
    Location
    Middlesbrough
    Posts
    149
    Thank Post
    23
    Thanked 26 Times in 21 Posts
    Rep Power
    19

    create a folder with dates,

    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

  2. #2

    Join Date
    Nov 2007
    Location
    Preston
    Posts
    98
    Thank Post
    2
    Thanked 4 Times in 4 Posts
    Rep Power
    15
    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

  3. #3
    Heebeejeebee's Avatar
    Join Date
    Nov 2006
    Location
    Intergalactic Cruise
    Posts
    1,067
    Thank Post
    69
    Thanked 81 Times in 64 Posts
    Rep Power
    36
    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
    Attached Files Attached Files

  4. Thanks to Heebeejeebee from:

    sharkster (3rd April 2008)



SHARE:
+ Post New Thread

Similar Threads

  1. Dates in SIMS reports
    By cjohnsonuk in forum MIS Systems
    Replies: 0
    Last Post: 19th March 2008, 01:25 PM
  2. dates for admin pak
    By goodhead in forum Windows Vista
    Replies: 5
    Last Post: 7th March 2007, 05:42 PM
  3. Replies: 5
    Last Post: 10th January 2007, 03:55 PM
  4. BSF dates - are you prepared?
    By CyberNerd in forum BSF
    Replies: 29
    Last Post: 1st December 2006, 10:43 AM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •