Skip to main content

** SOLUTION WITHIN! ... Add option to delete all previous backups 'before' every new "full version" (only)

Thread needs solution

I like the Acronis True Image 2015 - File Backup functionality with all the different types of backup methods. Unfortunately, it seems that because my full backup files are so large, there may not be room enough for more than one on my backup drive for saving. So I need a "(non-default) option" in the functionality to be able to delete "all previous backup files" before creating new "full versions". I would also like this to work with methods like the Differential method, so that 1) an initial full version is created, then 2) several differential versions, then 3) all the previous versions (full and differential) are deleted, after which a new full version is created.

I would think this would be an important option to people. Otherwise, you force all backup files to be less than half of the backup drive size every time, or the backup process always crashes.

Btw, it is not particularly important to me that there is a small gap of time where no backup exists, as this process is just for partial/specific file backups... I actually also run a full system image backup every so often too. As mentioned, this would only be an additional " (non-default) option" which a TI 2015 user can choose to use or not, depending on their needs.

Thanks.

0 Users found this helpful

Just in case anyone was interested, I solved this problem by using the following (attached and below) Microsoft Windows Batch file that I wrote (I named it "Delete All Acronis Backup Files for a New Full Backup.bat". It's a plain text file that you can read an edit using Notepad ... I do software development work as a career, btw). It deletes all Acronis *.tib files in a directory before doing another backup, but only when the number of *.tib files in that directory is greater or equal to a specified number (see below). I use it in Windows 8.1, but the batch commands should be generic enough for use in earlier versions of Windows as well (it's pretty simple).

You need to put the file ("Delete All Acronis Backup Files for a New Full Backup.bat") into the same directory that the backup files (*.tib) will go, and reference the file using the Acronis Backup option in "Operations --> Edit Settings --> Options --> Advanced --> Pre-Post Commands --> Use Custom Commands --> Pre-command --> Edit button -- Command text box". Also should put a number in the "Arguments" box there to specify to the batch file script the number of *.tib files to look for in that directory before deleting them before each backup... the default is currently set to 5 if no number is entered (e.g. 1 full backup file and 4 differential backups ... which corresponds to my Differential Backup method of "creating a full version after every '4' differential versions"). Below is the script that you can read.

Please note that the script will delete ALL *.tib files in that directory when the "max number of files" condition is met, even if those *.tib files are for another backup. So other backups should be placed in another directory!

(Another) NOTE!!!: This forum does not allow files with the *.bat extension to be uploaded (or spaces and capital letters), so I changed the attached file name to end with .txt and added a note. To use the file, remove the note and the .txt extension so that the file is named "Delete All Acronis Backup Files for a New Full Backup.bat" as mentioned. Btw, you can name the file anything you want, as long as it ends with .bat and is referenced from the Acronis Backup application functionality as mentioned above.

Enjoy.

(below is the Microsoft Windows Batch Script text that the attached file contains)
########################################

@echo off

set numBackupFilesFound=0
set minNumBackupFilesToDeleteAll=5
set fileSelector=*.tib

if "%1" NEQ "" (
echo Received the parameter minNumBackupFilesToDeleteAll: %1
set minNumBackupFilesToDeleteAll=%1
)

for %%f in (%fileSelector%) do (
echo "Found Acronis backup file: %%f"
set /A numBackupFilesFound+=1
)
echo "The number of Acronis backup files found: %numBackupFilesFound%"
echo "Minimum number of Acronis backup files needed to delete all: %minNumBackupFilesToDeleteAll%"

if "%numBackupFilesFound%" GEQ "%minNumBackupFilesToDeleteAll%" (
echo "------------------------------------------------------------"
echo "Deleting all Acronis backup files..."
for %%f in (%fileSelector%) do (
del "%%f"
echo "Deleted the Acronis backup file: %%f"
)
echo "...Finished deleting all Acronis backup files."
echo "------------------------------------------------------------"
) else (
echo "Not enough Acronis backup files found to delete."
)

Attachment Size
228614-116626.txt 986 bytes

Thanks for the script, could I just suggest that for those using Win 7 and above they change the 'bat' extension to 'cmd'.

Might even be worth converting it to a Powershell script.

Douglas,
Thank you for taking the time to create this script for use by the users who may be interested. There have been many instances of users wanting or needing to have the old files deleted prior to backup replacement. Note that TrueImage does not delete the old files until AFTER a replacement has been created. I believe this to be the correct policy when only one choice is offered but many many of us have requested that the program offer user standard choices as to whether the deletes be done before or after the replacement is created. As you have stated, some users do not have the room for extra storage space needed when the replacement is created first.

You may have an interest in my signature link #1, item 5 (Guides by MVP OracleDBA )inside that link which is an offering of Chain2Gen helper program for TrueImage.
This was written by the then MVP Oracledba, also a programmer and was written for version 2009 and 2010 but still works for the more current versions.
This has options to also delete prior to backup creation plus many more user options as to when a full backup can occur.

TrueImage does not seem to take well to task editing and usually does not perform correctly following edits--or at least prior versions did not.
You may want to consider having the edits of the variable to occur inside the batch file via notepad rather than as an added variable inside the Pre-command command variable.

Thank you again.

Grover

Hi GroverH,

Thanks for the information. Regarding your last statement "You may want to consider having the edits of the variable to occur inside the batch file via notepad rather than as an added variable inside the Pre-command command variable." ... that should already be the case with the script that I wrote. If a value is not sent into the script from a caller, it uses its internal default value of 5, which can be edited within the script file. The line to change that value in the script is:

set minNumBackupFilesToDeleteAll=5

-Douglas

Douglas, I was having the same problem you described. Your script works BEAUTIFULLY! This was the solution I needed. Thanks for the detailed explanation on how to modify the script to fit different needs. This is certainly an easy solution to the problem I was having.

Matt

Hi Douglas, really appreciate the script! works a treat, is there any way to tweak this so it can remove all *.tib files except for a minimum amount? Ie, I use full and incremental backups and wish to have something to fall back on, preferably the latest file or 2.