User Tools

Site Tools


backup_script_cygwin

Backup Script (Cygwin)

This script is obsolete. Please consider the backup_script_7zip rather than this one.

REM This script requires Cygwin to work. 
 
@ECHO OFF
 
SET source=C:\External Drives\USB Key - Kissing Frogs\KissingFrogs.co.nz\Test\V5
SET backupDir=C:\Backups\KissingFrogs.co.nz
 
if not exist "%source%" goto :done
 
zip -r "%backupDir%\backup_temp.zip" "%source%"
 
if not exist "%backupDir%\backup01.zip" goto :roll_done
 
zipinfo -v "%backupDir%\backup01.zip" | tail +2 > "%backupDir%\backup01.txt"
zipinfo -v "%backupDir%\backup_temp.zip" | tail +2 > "%backupDir%\backup_temp.txt"
 
diff -q "%backupDir%\backup01.txt" "%backupDir%\backup_temp.txt"
 
IF ERRORLEVEL 1 GOTO :differences_exist

REM No differences found, so just clean up.
rm "%backupDir%\backup01.txt" "%backupDir%\backup_temp.zip" "%backupDir%\backup_temp.txt"
GOTO :done
 
:differences_exist
rm "%backupDir%\backup01.txt" "%backupDir%\backup_temp.txt"
 
:roll_start
rm "%backupDir%\backup50.zip"
mv "%backupDir%\backup49.zip" "%backupDir%\backup50.zip"
mv "%backupDir%\backup48.zip" "%backupDir%\backup49.zip"
mv "%backupDir%\backup47.zip" "%backupDir%\backup48.zip"
mv "%backupDir%\backup46.zip" "%backupDir%\backup47.zip"
mv "%backupDir%\backup45.zip" "%backupDir%\backup46.zip"
mv "%backupDir%\backup44.zip" "%backupDir%\backup45.zip"
mv "%backupDir%\backup43.zip" "%backupDir%\backup44.zip"
mv "%backupDir%\backup42.zip" "%backupDir%\backup43.zip"
mv "%backupDir%\backup41.zip" "%backupDir%\backup42.zip"
mv "%backupDir%\backup40.zip" "%backupDir%\backup41.zip"
mv "%backupDir%\backup39.zip" "%backupDir%\backup40.zip"
mv "%backupDir%\backup38.zip" "%backupDir%\backup39.zip"
mv "%backupDir%\backup37.zip" "%backupDir%\backup38.zip"
mv "%backupDir%\backup36.zip" "%backupDir%\backup37.zip"
mv "%backupDir%\backup35.zip" "%backupDir%\backup36.zip"
mv "%backupDir%\backup34.zip" "%backupDir%\backup35.zip"
mv "%backupDir%\backup33.zip" "%backupDir%\backup34.zip"
mv "%backupDir%\backup32.zip" "%backupDir%\backup33.zip"
mv "%backupDir%\backup31.zip" "%backupDir%\backup32.zip"
mv "%backupDir%\backup30.zip" "%backupDir%\backup31.zip"
mv "%backupDir%\backup29.zip" "%backupDir%\backup30.zip"
mv "%backupDir%\backup28.zip" "%backupDir%\backup29.zip"
mv "%backupDir%\backup27.zip" "%backupDir%\backup28.zip"
mv "%backupDir%\backup26.zip" "%backupDir%\backup27.zip"
mv "%backupDir%\backup25.zip" "%backupDir%\backup26.zip"
mv "%backupDir%\backup24.zip" "%backupDir%\backup25.zip"
mv "%backupDir%\backup23.zip" "%backupDir%\backup24.zip"
mv "%backupDir%\backup22.zip" "%backupDir%\backup23.zip"
mv "%backupDir%\backup21.zip" "%backupDir%\backup22.zip"
mv "%backupDir%\backup20.zip" "%backupDir%\backup21.zip"
mv "%backupDir%\backup19.zip" "%backupDir%\backup20.zip"
mv "%backupDir%\backup18.zip" "%backupDir%\backup19.zip"
mv "%backupDir%\backup17.zip" "%backupDir%\backup18.zip"
mv "%backupDir%\backup16.zip" "%backupDir%\backup17.zip"
mv "%backupDir%\backup15.zip" "%backupDir%\backup16.zip"
mv "%backupDir%\backup14.zip" "%backupDir%\backup15.zip"
mv "%backupDir%\backup13.zip" "%backupDir%\backup14.zip"
mv "%backupDir%\backup12.zip" "%backupDir%\backup13.zip"
mv "%backupDir%\backup11.zip" "%backupDir%\backup12.zip"
mv "%backupDir%\backup10.zip" "%backupDir%\backup11.zip"
mv "%backupDir%\backup09.zip" "%backupDir%\backup10.zip"
mv "%backupDir%\backup08.zip" "%backupDir%\backup09.zip"
mv "%backupDir%\backup07.zip" "%backupDir%\backup08.zip"
mv "%backupDir%\backup06.zip" "%backupDir%\backup07.zip"
mv "%backupDir%\backup05.zip" "%backupDir%\backup06.zip"
mv "%backupDir%\backup04.zip" "%backupDir%\backup05.zip"
mv "%backupDir%\backup03.zip" "%backupDir%\backup04.zip"
mv "%backupDir%\backup02.zip" "%backupDir%\backup03.zip"
mv "%backupDir%\backup01.zip" "%backupDir%\backup02.zip"
:roll_done
 
mv "%backupDir%\backup_temp.zip" "%backupDir%\backup01.zip"
 
:done
backup_script_cygwin.txt · Last modified: 2017/01/01 20:05 by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki