Access backup

aman

Registered User.
Local time
Today, 03:28
Joined
Oct 16, 2008
Messages
1,251
Hi All

I have one question, Is it possible to take daily backup of Access database in any folder automatically at any specific time e.g 9pm at night. This is just to make sure that data is safe and nobody moved the current folder or deleted the folder where the system is present(SO in case anything goes wrong with the system).

Any suggestions???

Thanks
 
One way would be to write a batch file and add it to Windows' task scheduler.

Attached is an example batch file. The file extension needs to be changed from .txt to .bat, but first it needs to be edited in something like notepad to have file names and paths added.

My batch file will do the following:

1. Delete the backup from the previous day
2. Copy the live file to the backup folder
3. Rename the backup file to include a datestamp


If you are uneasy editing the file for use I will create a copy to meet your needs. I just need the full path of the live file & the full path which you want to backup to.
 

Attachments

It helped me too...here is my code with concrete paths...very thanks

@Echo off
echo.Backing up database...

set dd=%Date:~0,2%
set mm=%Date:~3,2%
set yy=%Date:~6,4%

set ddy=%Date:~0,2%
set mmy=%Date:~3,2%
set yyy=%Date:~6,4%

set /A ddy -= 1
if %ddy%==0 set /A mmy-=1
if %mmy%==0 (
set mmy=12
set /A yyy-=1
)
if %ddy%==0 (
if %mmy%==12 set ddy=31
if %mmy%==11 set ddy=30
if %mmy%==10 set ddy=31
if %mmy%==9 (
set ddy=30
set mmy=09)
if %mmy%==8 (
set ddy=31
set mmy=08)
if %mmy%==7 (
set ddy=31
set mmy=07)
if %mmy%==6 (
set ddy=30
set mmy=06)
if %mmy%==5 (
set ddy=31
set mmy=05)
if %mmy%==4 (
set ddy=30
set mmy=04)
if %mmy%==3 (
set ddy=31
set mmy=03)
if %mmy%==2 (
set ddy=28
set mmy=02)
if %mmy%==1 (
set ddy=31
set mmy=01)
)

set DateToday=%dd%_%mm%_%yy%
set DateYesterday=%ddy%_%mmy%_%yyy%

set BackupPath=D:\personal\peter.kain\home\databaza_Packaging\Zaloha\
set LivePath=\\Sbra01\logistics\3_Prijem\Evidencia vratnych obalov\

set LiveFile=%LivePath%Balenie.mdb
set DefaultBackup=%BackupPath%Balenie.mdb
set NewBackup=Balenie_%DateToday%.mdb
set OldBackup=%BackupPath%Balenie_%DateYesterday%.mdb

del /q "%OldBackup%" 2>NUL
xcopy "%LiveFile%" "%BackupPath%" /c /r /d /y /i > "%BackupPath%xcopy.log"
rename "%defaultBackup%" "%NewBackup%"

echo on
 

Users who are viewing this thread

Back
Top Bottom