1 pièce(s) jointe(s)
Besoin d'aide pour un batch de sauvegarde incrementale
Bonjour,
actuellement je dois faire un petit batch pour mon entreprise afin qu'une employé puisse sauvegarder les données de son disque externe sur le pc de la boite.
Je suis administrateur système et réseaux débutant et j'avoue que la programmation et moi ne somme pas bon copain. J'ai don récupérer un bon exemple sur le net que j'ai suivie mais j'arrive toujours pas aux résultats souhaité. J'ai fais toutes modifications qui me semblé nécessaire mais rien. Si quelqu'un à la patience et le temps de m'aider ça serais hyper cool. sa fais 2jours que je suis dessus et franchement je ne sais plus quoi faire.
Cordialement,
J'ai légèrement avancer, mais il me reste encore un problème c'est que je voudrais faire une sauvegarde incremental mais ça ne fonctionne pas si quelqu'un pourrais avoir une idée ci-dessou le code:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106
|
@ECHO OFF
COLOR 0A
echo.Date : %date%
echo.Time : %time%
REM BackupScript
REM Version 1.01, Updated: 2008-05-21
REM By Jason Faulkner (articles[-at-]132solutions.com)
REM Performs full or incremental backups of folders and files configured by the user.
REM Usage---
REM > BackupScript
echo.
pause
SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION
REM ---Configuration Options---
REM SET BackupStorage=D:\TEST
REM Which day of the week do you want to perform a full backup on?
REM Enter one of the following: Sun, Mon, Tue, Wed, Thu, Fri, Sat, *
REM Any day of the week other than the one specified below will run an incremental backup.
REM If you enter '*', a full backup will be run every time.
SET FullBackupDay=Mon
SET dirBackup=E:\SAUVEGARDE
SET filBackupConfig=BackupConfig.txt
REM Validation.
IF NOT EXIST %filBackupConfig% (
echo.
echo.
echo No configuration file found, missing: %filBackupConfig%
)
REM Backup variables.
FOR /f "tokens=1,2,3,4 delims=/ " %%a IN ('date /t') DO (
SET DayOfWeek=%%a
SET NowDate=%%d-%%b-%%c
SET FileDate=%%b-%%c-%%d
)
IF {%FullBackupDay%}=={*} SET FullBackupDay=%DayOfWeek%
IF /i {%FullBackupDay%}=={%DayOfWeek%} (
SET txtBackup=Full
SET swXCopy=/e
)
ELSE (
SET txtBackup=Incremental
SET swXCopy=/s/d:%FileDate%
)
echo.
ECHO Starting to copy files.
IF NOT EXIST "%dirBackup%" MKDIR "%dirBackup%"
FOR /f "skip=1 tokens=*" %%A IN (%filBackupConfig%) DO (
SET Current=%%~A
IF NOT EXIST "!Current!" (
ECHO ERROR! Not found: !Current!
)
ELSE (
ECHO Copying: !Current!
SET Destination=%dirBackup%\!Current:~0,1!%%~pnxA
REM Determine if the entry is a file or directory.
IF "%%~xA"=="" (
REM Directory.
XCOPY "!Current!" "!Destination!" /v/c/i/g/h/q/r/y %swXCopy%
)
ELSE (
REM File.
COPY /v /y "!Current!" "!Destination!"
)
)
)
ECHO Done copying files.
echo.
REM If the backup file exists, remove it in favor of the new file.
rem IF EXIST "%BackupFileDestination%" DEL /f /q "%BackupFileDestination%"
ECHO.
rem ECHO Cleaning up.
REM IF EXIST "%dirBackup%" RMDIR /s /q "%dirTempBackup%"
ECHO.
:End
ECHO Finished.
ECHO.
pause
ENDLOCAL |