back up data base

I

iccsi

xcopy "E:\Databases\TRACKER.mdb" "D:\Documents and Settings\myuser
\Desktop\Database Backup\Track\" /c/r/y/a/d/s/v/q

I have above batch file to back up my database. It replaced the old
mdb file.

Is it possible to have the batch file add time stamp that it does not
replace old file?

Like Tracker_09:30_Mar172009.mdb

Your help is great appreciated,
 
D

Danny J. Lesandrini

Below is a script I use in a .VBS file

Dim objScript, strSource, strTarget, strMsg, strDevFldr, strServFld
Dim sPrefix, sMonth, sDay, sYear, sHour, sMinuite

'If MsgBox("Backup files? ", 4+32,"Warning!") = 6 Then

' /////// NOTE: Edit variables in this section ///////
'
' The following lines of code are the only variable that need be edited
' You must provide a path to the folder where development files are kept
'
strDevFldr = "C:\Development\BDC\"
strServFld = "\\Pharmatech2003\Data\IT\Production\BDC\"
'
' /////// NOTE: Edit variables in this section ///////

' Get the file Prefix for archiv sake.
sMonth = DatePart("m",Date())
If Len(sMonth) = 1 Then sMonth = "0" & sMonth
sDay = DatePart("d",Date())
If Len(sDay) = 1 Then sDay = "0" & sDay
sYear = Right(DatePart("yyyy",Date()),2)
sHour= DatePart("h",Now())
If Len(sHour) = 1 Then sHour = "0" & sHour
sMinuite = DatePart("n",Now())
If Len(sMinuite) = 1 Then sMinuite = "0" & sMinuite
sPrefix = sMonth & "-" & sDay & "-" & sYear & " " & sHour & "_" & sMinuite & "_"

' Create Scripting Object
Set objScript = CreateObject("Scripting.FileSystemObject")

' ***************************************************************************
' Compact/Backup BDC to Server Dev Archive
strSource = strDevFldr & "BDC.adp"
strTarget = strServFld & "Dev_Copy\" & sPrefix & "BDC.adp"
'objScript.DeleteFile strTarget
objScript.CopyFile strSource ,strTarget
'
' ***************************************************************************

' ***************************************************************************
' Compact/Backup BDC to Local Staging
strSource = strDevFldr & "BDC.adp"
strTarget = strDevFldr & "Staging\BDC.adp"

objScript.DeleteFile strTarget
objScript.CopyFile strSource ,strTarget
'
' ***************************************************************************


' Clean up
Set objAccess = Nothing

' Finished
MsgBox "Finished compacting/backing up development databases."
'End If
 
I

inungh

Below is a script I use in a .VBS file

Dim objScript, strSource, strTarget, strMsg, strDevFldr, strServFld
Dim sPrefix, sMonth, sDay, sYear, sHour, sMinuite

'If MsgBox("Backup files?           ", 4+32,"Warning!") = 6 Then

 ' /////// NOTE: Edit variables in this section ///////
 '
 '  The following lines of code are the only variable that need be edited
 '  You must provide a path to the folder where development files arekept
 '
     strDevFldr = "C:\Development\BDC\"
     strServFld = "\\Pharmatech2003\Data\IT\Production\BDC\"
 '
 ' /////// NOTE: Edit variables in this section ///////

 ' Get the file Prefix for archiv sake.
     sMonth = DatePart("m",Date())
     If Len(sMonth) = 1 Then sMonth = "0" & sMonth
     sDay = DatePart("d",Date())
     If Len(sDay) = 1 Then sDay = "0" & sDay
     sYear = Right(DatePart("yyyy",Date()),2)
     sHour= DatePart("h",Now())
     If Len(sHour) = 1 Then sHour = "0" & sHour
     sMinuite = DatePart("n",Now())
     If Len(sMinuite) = 1 Then sMinuite = "0" & sMinuite
     sPrefix = sMonth & "-" & sDay & "-" & sYear & " " & sHour & "_" & sMinuite & "_"

 ' Create Scripting Object
        Set objScript = CreateObject("Scripting.FileSystemObject")

 ' ***************************************************************************
 ' Compact/Backup BDC to Server Dev Archive
  strSource = strDevFldr & "BDC.adp"
  strTarget = strServFld & "Dev_Copy\" & sPrefix & "BDC.adp"
        'objScript.DeleteFile strTarget
     objScript.CopyFile  strSource ,strTarget
 '
 ' ***************************************************************************

 ' ***************************************************************************
 ' Compact/Backup BDC to Local Staging
  strSource = strDevFldr & "BDC.adp"
  strTarget = strDevFldr & "Staging\BDC.adp"

        objScript.DeleteFile strTarget
     objScript.CopyFile strSource ,strTarget
 '
 ' ***************************************************************************

 ' Clean up
     Set objAccess = Nothing

 ' Finished
  MsgBox "Finished compacting/backing up development databases."
'End If

--
Danny J. Lesandrini
(e-mail address removed)









- Show quoted text -

Thanks for the message,
Are there any solution using batch files?

Thanks again,
 
D

Danny J. Lesandrini

How about this ...
I don't have any code to create a timestamp, but this does work in a .bat file.

REM THIS BATCH FILE COPIES THE CLIENT FROM SERVER
REM AND STARTS THE PROGRAM

copy "C:\Program Files\Quote Contract Manager\QCM.adp" "C:\Program Files\Quote Contract Manager\QCM_bak.adp"
copy "S:\QCM\qcm.adp" "C:\Program Files\Quote Contract Manager\QCM.adp"
START "C:\Program Files\Microsoft Office\Office10\msaccess.exe" "C:\Program Files\Quote Contract Manager\QCM.adp"

EXIT

--
Danny J. Lesandrini
(e-mail address removed)
www.amazecreations.com





< Thanks for the message,
< Are there any solution using batch files?

< Thanks again,
 
I

inungh

How about this ...
I don't have any code to create a timestamp, but this does work in a .batfile.

REM  THIS BATCH FILE COPIES THE CLIENT FROM SERVER
REM  AND STARTS THE PROGRAM

copy "C:\Program Files\Quote Contract Manager\QCM.adp" "C:\Program Files\Quote Contract Manager\QCM_bak.adp"
copy "S:\QCM\qcm.adp" "C:\Program Files\Quote Contract Manager\QCM.adp"
START "C:\Program Files\Microsoft Office\Office10\msaccess.exe" "C:\Program Files\Quote Contract Manager\QCM.adp"

EXIT

--
Danny J. Lesandrini
(e-mail address removed)

 < Thanks for the message,
 < Are there any solution using batch files?

 < Thanks again,

Thanks, it is a good idea.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top