[Solved] Full and incremental backup for several weeks

Discussion in 'Acronis True Image Product Line' started by albrecht, Dec 20, 2006.

Thread Status:
Not open for further replies.
  1. albrecht

    albrecht Registered Member

    Joined:
    Dec 7, 2006
    Posts:
    5
    Hello,

    a few weeks ago I asked the same question in here as many other users do who like to use Acronis True Image for full and incremental backups of several weeks that do not overwrite themselves.

    1.)
    A typical but quite exhausting answer is:
    This proposal is well meant but for a small computer network of let's say 10 computers that should have backups of four weeks you have to plan 80 tasks! You cannot do this at once, you have to start with 20 tasks and have to wait one week to plan the next 20 nearly *identical* tasks......

    2.)
    A better answer was:
    This is well meant, too, but at last...

    3.)
    The best answer *would have been*:

    Code:
    :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    :: Script: Backup backups! ::            
    :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    ::
    :: Script call:
    ::         backup_backups.cmd <backupDestinationPath>
    ::         backup_backups.cmd \\server\backup-share\workstation01
    ::
    ::         <backupDestinationPath> 	Path to the directory the backups are saved in
    ::
    :: No guaranteed functionality. Please try the script with sample files first.
    
    
    @echo off
    
    
    :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    :: Options  ::
    ::::::::::::::
    
    :: Name of the folders existing backups are moved to
    set lastWeekBackupsFolderName=backup_last
    set weekBeforeLastWeekBackupsFolderName=backup_before_last
    
    :: Name of the backup archive WITHOUT file extension (.tib)!!!
    :: (Optional. You may leave it blank when no other backups are done to this directory)
    set backupFileName=fullBackupFileName
    
    
    :: Generic backup path (defined by the given argument)
    set backupPath=%1
    
    :: Log-Filename
    set logFile=log.txt
    
    
    
    :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    :: Preparation ::
    ::::::::::::::::::
    
    :: Create log-file path
    set logFile=%backupPath%\%logFile%
    
    
    
    :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    :: Execution ::
    ::::::::::::::::::
    
    echo ---------------------------------------------------------	>> %logFile%
    echo %date% %time%	>> %logFile%
    pwd			>> %logFile%
    
    
    if exist "%backupPath%\%backupFileName%*.tib" (
    	
    	:: Create subdirectory for last backup (backup_last)
    	if not exist "%backupPath%\%lastWeekBackupsFolderName%" (
    		mkdir "%backupPath%\%lastWeekBackupsFolderName%"
    		echo mkdir "%backupPath%\%lastWeekBackupsFolderName%" 	>> %logFile%
    	)
    	
    
    	:: Are there existing backups from last week?
    	if exist "%backupPath%\%lastWeekBackupsFolderName%\%backupFileName%*.tib" (
    		
    		:: Create subdirectory for backup before last backup (backup_before_last)
    		if not exist "%backupPath%\%weekBeforeLastWeekBackupsFolderName%" (
    			mkdir "%backupPath%\%weekBeforeLastWeekBackupsFolderName%"
    			echo mkdir "%backupPath%\%lastWeekBackupsFolderName%" 	>> %logFile%
    		)
    
    		:: Backup existing backups of week before last week
    		move "%backupPath%\%lastWeekBackupsFolderName%\%backupFileName%*.tib" "%backupPath%\%weekBeforeLastWeekBackupsFolderName%\"
    		echo Move %backupPath%\%lastWeekBackupsFolderName%\%backupFileName%*.tib 			>> %logFile%
    		echo       to %backupPath%\%weekBeforeLastWeekBackupsFolderName%\%backupFileName%*.tib	>> %logFile%
    
    	)
    	
    	:: Backup existing backups of last week
    	move "%backupPath%\%backupFileName%*.tib" "%backupPath%\%lastWeekBackupsFolderName%\"
    	echo Move %backupPath%\%backupFileName%*.tib					>> %logFile%
    	echo       to %backupPath%\%lastWeekBackupsFolderName%\%backupFileName%*.tib		>> %logFile%
    
    )
    
    :::::::::::::
    :: The End ::
    :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    
    You can easily modify the script for usage in other intervals (e. g. four weeks) and you would do a great job to define a variable numberOfFullBackupBackups and do the moving of backups in a for-loop. Of course you may post your modifications in here!


    Merry christmas!

    Sebastian
     
Thread Status:
Not open for further replies.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.