Script to copy database

Tony amccabe at hawkeyerec.com
Tue Aug 14 09:50:44 EDT 2007


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

Thanks again for your help.
Tony



"Laurent Pointal" <laurent.pointal at limsi.fr> wrote in message 
news:f9s9ks$hns$1 at news2.u-psud.fr...
> 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 





More information about the Python-list mailing list