Ga naar inhoud

backup script / backup verdwijnt na compressie


Aanbevolen berichten

hallo, ik heb een backup script draaien deze voert alles netjes uit maar zodra de compressie klaar is verdwijnt de backup van de backup schijf. weet iemand toevallig ofdat ik een fout heb gemaakt? op een oplossing? dit is het script: @ECHO OFF 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 SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION REM ---Configuration Options--- REM Folder location where you want to store the resulting backup archive. REM This folder must exist. Do not put a '\' on the end, this will be added automatically. REM You can enter a local path, an external drive letter (ex. F:) or a network location (ex. \\server\backups) SET BackupStorage=E:\Backup 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=zo REM Location where 7-Zip is installed on your computer. REM The default is in a folder, '7-Zip' in your Program Files directory. SET InstallLocationOf7Zip=%ProgramFiles%\7-Zip REM +-----------------------------------------------------------------------+ REM | Do not change anything below here unless you know what you are doing. | REM +-----------------------------------------------------------------------+ REM Usage variables. SET exe7Zip=%InstallLocationOf7Zip%\7z.exe SET dirTempBackup=%TEMP%\backup SET filBackupConfig=BackupConfig.txt REM Validation. IF NOT EXIST %filBackupConfig% ( ECHO No configuration file found, missing: %filBackupConfig% GOTO End ) IF NOT EXIST "%exe7Zip%" ( ECHO 7-Zip is not installed in the location: %dir7Zip% ECHO Please update the directory where 7-Zip is installed. GOTO End ) 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=%%a-%%b-%%c ) IF {%FullBackupDay%}=={*} SET FullBackupDay=%DayOfWeek% IF /i {%FullBackupDay%}=={%DayOfWeek%} ( SET txtBackup=Full SET swXCopy=/e ) ELSE ( SET txtBackup=Incremental SET swXCopy=/s ) ECHO Starting to copy files. IF NOT EXIST "%dirTempBackup%" MKDIR "%dirTempBackup%" 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=%dirTempBackup%\!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. SET BackupFileDestination=%BackupStorage%\Backup_%FileDate%_%txtBackup%.zip REM If the backup file exists, remove it in favor of the new file. IF EXIST "%BackupFileDestination%" DEL /f /q "%BackupFileDestination%" ECHO Compressing backed up files. (New window) REM Compress files using 7-Zip in a lower priority process. REM START "Compressing Backup. DO NOT CLOSE" /belownormal /wait REM "%exe7Zip%" a -tzip -r -mx5 "%BackupFileDestination%" "%dirTempBackup%\" c:\Progra~1\7-Zip\7z.exe a -tzip -r -mx5 "%BackupFileDestination%" "%dirTempBackup%\" copy "%BackupFileDestination%" f:\backup ECHO Done compressing backed up files. ECHO. ECHO Cleaning up. forfiles -p e:\backup -s -m *.* -d -14 -c "cmd /c del /q @PATH" forfiles -p f:\backup -s -m *.* -d -14 -c "cmd /c del /q @PATH" IF EXIST "%dirTempBackup%" RMDIR /s /q "%dirTempBackup%" ECHO. :End ECHO Finished. ECHO. ENDLOCAL
Link naar reactie
Ik weet niet welke taal dit is, maar waarschijnlijk zit de crux hierin: [code:1:e3f9def189]ECHO Cleaning up. forfiles -p e:\backup -s -m *.* -d -14 -c "cmd /c del /q @PATH" forfiles -p f:\backup -s -m *.* -d -14 -c "cmd /c del /q @PATH" IF EXIST "%dirTempBackup%" RMDIR /s /q "%dirTempBackup%" ECHO. [/code:1:e3f9def189]
Link naar reactie
[quote:dc9a1e1eac="Ger"]Ik weet niet welke taal dit is, maar waarschijnlijk zit de crux hierin: [code:1:dc9a1e1eac]ECHO Cleaning up. forfiles -p e:\backup -s -m *.* -d -14 -c "cmd /c del /q @PATH" forfiles -p f:\backup -s -m *.* -d -14 -c "cmd /c del /q @PATH" IF EXIST "%dirTempBackup%" RMDIR /s /q "%dirTempBackup%" ECHO. [/code:1:dc9a1e1eac][/quote:dc9a1e1eac] Het is een Batch script. Mij ook, Ik denk dat het fout gaat vanwege localisatie. Dit is geschreven voor een engelse windows, terwijl je een nederlandse draait. dit vanwege deze code[code:1:dc9a1e1eac] 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=zo [/code:1:dc9a1e1eac] Als jij een engelse.us windows gebruikt had, had daar ipv "zo" "sun" moeten staan. Makkelijkste oplossing: Haal deze twee regels eruit [code:1:dc9a1e1eac]forfiles -p e:\backup -s -m *.* -d -14 -c "cmd /c del /q @PATH" forfiles -p f:\backup -s -m *.* -d -14 -c "cmd /c del /q @PATH" ECHO. [/code:1:dc9a1e1eac] Deze regels deleten backups ouder dan twee weken op een engelse/us versie van windows, maar doordat hij niet de goede parameters krijgt, verwijderd hij alles. Door ze te deleten, verwijdert hij alleen nog de temp files, maar laat hij alle backups staan.
Link naar reactie
@ Marc H sorry was al terug aan het reageren voordat ik je bericht had gelezen. maar het is een engelse server waarop is ingesteld dat hij nederlandse tijd moet met daarbij de nederlandse dag namen weergeven dus ofdat ik zo of sun gebruikt maakt niet zo heel veel uit. en de dagnaam ze hij er niet meer in alleen (in nederlandse vorm) dd-mm-jj maar ik zal die 2 regels is weghalen en kijken wat hij doet, handmatig en na de geplande task bedankt voor jullie reacties in iedergeval en het zal dan pas maandag worden denk ik of dat het heeft gewerkt:P
Link naar reactie
Ik heb even het originele script opgehaald, en daarin staan die twee "delete" regels helemaal niet. Maar als ik die regel, en alleen die regel, even test op mijn eigen fileserver, werkt hij gewoon. Hij delete alleen de bestanden ouder dan twee weken. (2008 server, US, Nederlandse tijd/datum weergave) Waarom delete je trouwens zowel de backup van de E: schijf, als ook de backup van de f:\ schijf, als er alleen een backup gemaakt word naar de E:\ schijf? Je zou de cleanup van de files ouder dan twee weken, apart kunnen schedulen, buiten het script, als dat wel goed gaat.
Link naar reactie
hij schrijft zover ik kan zien ook een .backup file naar die andere schijf dit is een aparte externe HDD waar ze een backup van de backups wilde hebben...vraag me niet waarom maar klant is koning ik zal is even kijken wat je me adviseerd. ik heb voor alternatieve oplossing ook nog een apart scriptje voor iedere dag die we toevallig ergens anders hebben draaien. die wel netjes werkt. dat zal dan zoiets als dit worden: maar hartelijk dank voor het meedenken en de moeite die je erin hebt gestoken! stel ik zeer op prijs! (is van ergens anders) [code:1:4e219dedf2] @echo off cd c:\ for /F "tokens=*" %%G in ('dir/b "c:\data"') DO ( for /F "tokens=*" %%H in ('dir/b "c:\data\%%G"') DO ("C:\Program Files\7-Zip\7z.exe" a -uz1y2r2w1q0 -t7z -wc:\ "d:\dinsdag\%%G\%%H.7z" "c:\data\%%G\%%H" -ms=off)) "C:\Program Files\7-Zip\7z.exe" a -uz1y2r2w1q0 -t7z -wc:\ d:\dinsdag\mail.7z c:\backup\pst -ms=off xcopy "c:\backup\Dagelijkse_systeem_Backup.bkf" d:\dinsdag /E/C/Y/D [/code:1:4e219dedf2]
Link naar reactie

Om een reactie te plaatsen, moet je eerst inloggen

Gast
Reageer op dit topic

×   Geplakt als verrijkte tekst.   Herstel opmaak

  Er zijn maximaal 75 emoji toegestaan.

×   Je link werd automatisch ingevoegd.   Tonen als normale link

×   Je vorige inhoud werd hersteld.   Leeg de tekstverwerker

×   Je kunt afbeeldingen niet direct plakken. Upload of voeg afbeeldingen vanaf een URL in

×
×
  • Nieuwe aanmaken...