[AccessD] Automatic backup

Jim Dettman jimdettman at verizon.net
Thu Mar 17 12:35:22 CDT 2016


Susan,

This will get you started:

echo On
echo %date%
echo %time%
set TSyear=%date:~-2,2%
set TSmonth=%date:~-8,2%
set TSday=%date:~-5,2%
set TShour=%time:~-11,2%
IF "%time:~-11,1%" ==" " set TShour=0%time:~-10,1%
set TSminute=%time:~-8,2%
set TSseconds=%time:~-5,2%
set FileTS=%TSyear%%TSmonth%%TSday%%TShour%%TSminute%%TSseconds%
COPY %1  %2_%FileTS%_BKUP

 This works with a date in the format of:

ddd mm/dd/yy

 Your system might be different.  Drop to a command prompt and type:

Echo %date%

 and hit return to see the current format.  Or you can run the above.   I
left echo on and a display of the date and time included.  If you open a
command prompt and run the batch file, you will see all the output.  Time
should be OK 

You can also execute with:   Mybatch.bat > BatchLog.txt

 Any output will be re-directed to the file where you can see the results.  

  If it needs any tweaking, the commands are counting characters from the
right to the left, then taking the length.

 Inputs are source and destination, so:

  Bkup.Bat "C:\TEMP\myDB.MDB" "C:\Backups\myDB.MDB"   > BatchLog.txt

Jim.

-----Original Message-----
From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of FW
Salato Center
Sent: Thursday, March 17, 2016 10:28 AM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Automatic backup

Yes, an example would be very much appreciated! :) 

Susan H. 

 You can't do that inside in any easy way from inside your app while it's
executing.   To keep things simple, just setup a batch file with a shortcut
on the desktop.  The batch file doesn't have to be anything more than a file
copy and you'll probably want to suffix the date/time on that.  Let me know
if you want an example.

 Your other option would be to write it in VBA in a small utility DB, again
assuming you want to keep it simple.



-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com



More information about the AccessD mailing list