Re: Script to copy database



Thanks Laurent. That was very helpful. Pretty easy too.

Thanks again for your help.
Tony



"Laurent Pointal" <laurent.pointal@xxxxxxxx> wrote in message
news:f9s9ks$hns$1@xxxxxxxxxxxxxxxxxx
Tony a écrit :
I'm new at this and would like to know how set up a script to copy a
database from a local computer to a network at a certain time everyday.
Should be simple enough, but, as of now I am unfamiliar with how to do
this. Would this be done by writing a script and setting up a scheduled
task to run the script? Can anyone help me with the script? Just need
it to copy an Access database from the local C: drive to a network F:
drive.

Thanks,
Tony

As you wrote about c: and f:, I imagine you are working under Windows.
IMHO you dont need Python for that.

domybackup.bat

copy c:\mypathtothefile\thefile.xxx F:\mypathdobackudir\


And use your "planificateur de taches" (its corresponding english control
panel) to setup a periodic call to this batch file, eventually associate
an ad-hoc account to the task, so that the batch can access the file to
backup.


If you need more (ie. network access to setup/clean), here is a copy of a
script I use to export (using a Python script) an Access database. Just
replace the call to the Python script by a simple call to copy xxx yyyy.



@echo off
REM LANCEMENT DE L'EXPORT DE LA BASE ADMINISTRATIVE EN MODE TACHE
REM DE FOND (BATCH).

SET EXPORTS_BATCH=1
REM Parametres pour se connecter a la machine de transfert.
SET EXPORTS_HOST=thecomputer
SET EXPORTS_SHARE=data
SET EXPORTS_DRIVE=O:
SET EXPORTS_USER=theremotuser
SET EXPORTS_PASSWD=theremotepasswd
REM Montage du volume.
REM le start pour permettre d'attendre que le montage soit effectif.
START /wait NET USE %EXPORTS_DRIVE% \\%EXPORTS_HOST%\%EXPORTS_SHARE%
%EXPORTS_PASSWD% /USER:%EXPORTS_USER% /PERSISTENT:No
IF ERRORLEVEL 1 GOTO erreur_montage

REM Parametres pour le script Python.
SET SCRIPT_EXPORT="C:\Documents and Settings\myaccount\My
Documents\mybexport.py"
SET DSN_BASE_ADMIN=mydbaccound
SET LOGIN_BASE_ADMIN=mydbpasswd
SET PATH_FICHIERS_EXPORTS=%EXPORTS_DRIVE%\
REM Variables d'environnement eventuellement utiles...
SET TEMP=%PATH_FICHIERS_EXPORTS%
SET TMP=%PATH_FICHIERS_EXPORTS%
REM Lancement du script Python qui realise l'export.
C:\Tools\Python24\python.exe %SCRIPT_EXPORT%

REM Deconnexion du volume.
NET USE %EXPORTS_DRIVE% /DELETE

goto termine

:erreur_montage
ECHO "Erreur %ERROR_LEVEL% au montage de \\%EXPORTS_HOST%\%EXPORTS_SHARE%
en lecteur %EXPORTS_DRIVE%."

:termine


.



Relevant Pages

  • Re: Script to copy database
    ... Would this be done by writing a script and setting up a scheduled task to run the script? ... Just need it to copy an Access database from the local C: drive to a network F: drive. ... If you need more, here is a copy of a script I use to export (using a Python script) an Access database. ... REM LANCEMENT DE L'EXPORT DE LA BASE ADMINISTRATIVE EN MODE TACHE ...
    (comp.lang.python)
  • Re: Network Quarantine Policy Post Script
    ... I am trying to set up a VPN using Network Access ... I also found the sample script below somewhere on the ... echo RAS Connection = %1 ... REM Network policy compliance tests ...
    (microsoft.public.windows.server.networking)
  • Re: Running python script before user login
    ... work when I am login (python sendip.py). ... The first step would be to make sure your init script is actually running. ... (I think Ubuntu probably doesn't bring up the network before NetworkManager ...
    (comp.lang.python)
  • Batch ntbackup to external hard drives (new version - Sept 2006)
    ... Below is a new version of the backup script that I posted to USENET ... Disk drives are usually more portable than tape drives, ... rem 1) Edit the Script Customizations ...
    (microsoft.public.windows.server.general)
  • automate dcpromo during nt4 pdc upgrade to W2k3 DC
    ... I am attempting to script the upgrade of a NT4 PDC to a W2K3 domain ... I have set the UnAttendMode to ... FullUnattended and the upgrade works perfectly up to the point where the ... @rem SetupMgrTag ...
    (microsoft.public.windows.server.migration)