Author Topic: TweakingRegistryBackup.exe AutoDeleteOldBackupsDays=0 does not work?  (Read 10324 times)

0 Members and 1 Guest are viewing this topic.

Offline Merkas

  • Newbie
  • *
  • Join Date: Mar 2013
  • Posts: 3
  • Karma: 0
    • View Profile
Hi,

If you run TweakingRegistryBackup from the GUI and set the Delete Backups 0  Days or older in the Settings -> Auto Delete Old Backups. And then run the backup it deletes all of the old backups but the ones done today. I'm good with this.

Now if you run the TweakingRegistryBackup -auto from a batch file with the same settings (EX: AutoDeleteOldBackupsDays=0) it doesn't delete old backups at all. If you set the Delete Backups 1  Days then it at least deletes up to yesterday. I'd like to only have one backup keep if I could.

Is there a setting in the ini I'm missing?

Thanks

Offline Shane

  • Administrator
  • Hero Member
  • *****
  • Join Date: Sep 2011
  • Posts: 9281
  • Location: USA
  • Karma: 137
  • "Knowledge should be shared not hidden."
    • View Profile
Re: TweakingRegistryBackup.exe AutoDeleteOldBackupsDays=0 does not work?
« Reply #1 on: March 18, 2013, 03:39:07 pm »
Do you have the "keep at least" backups set to 0 as well?

The best way to do it if you have it set up to run at system start up is to have it keep the days set to 1, then under the advanced settings put a check on only do 1 backup per day. That should keep you at only 1 backup like you want :-)

Shane

Offline Merkas

  • Newbie
  • *
  • Join Date: Mar 2013
  • Posts: 3
  • Karma: 0
    • View Profile
Re: TweakingRegistryBackup.exe AutoDeleteOldBackupsDays=0 does not work?
« Reply #2 on: March 18, 2013, 05:26:19 pm »
Thanks for the quick reply.

The "Keep at least" backups is set to 0
The "Delete Backups ___ Days or older" is set to 0
The "Only do 1 Auto Backup per Day" is checked

Here is what the settings.ini file looks like;

[main]
ChangeBackupLocation=1
BackupLocation="C:\Jobs\552\SoftController\ct\graphics\links\Registry"
CheckForUpdates=0
AutoDeleteOldBackups=1
ScheduleUser=True
ScheduleSystem=False
VSSexe=Auto Detect (Default)
FallBackMethod=1
DefaultBackupName=Manual Backup
DefaultAutoBackupName=Auto Backup
DidCloseProperly=True
AlwaysUseFallBackMethod=1
BackupsToKeep=0
Only1AutoBackupPerDay=1
AutoDeleteOldBackupsDays=0

The batch file is run from a thumb drive and the location for the register backup it determined at run time and different per PC. So the Settings.ini file is created by the batch file. Here is what the batch file looks like;

:: -----------------------------------------------------------------------------------
:: Reg Backup
:: -----------------------------------------------------------------------------------
@echo [main]>Settings.ini
for %%A in ("ChangeBackupLocation=1") do @echo %%~A>>Settings.ini
@echo BackupLocation="%InsRegPath%">>Settings.ini
for %%A in ("CheckForUpdates=0") do @echo %%~A>>Settings.ini
for %%A in ("AutoDeleteOldBackups=1") do @echo %%~A>>Settings.ini
@echo ScheduleUser=True>>Settings.ini
@echo ScheduleSystem=False>>Settings.ini
@echo VSSexe=Auto Detect (Default)>>Settings.ini
for %%A in ("FallBackMethod=1") do @echo %%~A>>Settings.ini
@echo DefaultBackupName=Manual Backup>>Settings.ini
@echo DefaultAutoBackupName=Auto Backup>>Settings.ini
@echo DidCloseProperly=True>>Settings.ini
for %%A in ("AlwaysUseFallBackMethod=1") do @echo %%~A>>Settings.ini
for %%A in ("BackupsToKeep=0") do @echo %%~A>>Settings.ini
for %%A in ("Only1AutoBackupPerDay=1") do @echo %%~A>>Settings.ini
for %%A in ("AutoDeleteOldBackupsDays=0") do @echo %%~A>>Settings.ini

TweakingRegistryBackup.exe -auto

if not errorlevel 0 goto Warning
:: -----------------------------------------------------------------------------------

Really the only thing that changes it the backup location (%InsRegPath%).

If you run TweakingRegistryBackup.exe from the GUI with these settings it does delete the old backup as you would expect. If you run it from the batch file the old backups are not deleted. I think the reason the old backups are not deleted is because the "Delete Backups ___ Days or older" seems to default back to 30 even though this is not seen in the Settings.ini file. You do see it in the GUI.

Thanks
« Last Edit: March 18, 2013, 05:31:50 pm by Merkas »

Offline Shane

  • Administrator
  • Hero Member
  • *****
  • Join Date: Sep 2011
  • Posts: 9281
  • Location: USA
  • Karma: 137
  • "Knowledge should be shared not hidden."
    • View Profile
Re: TweakingRegistryBackup.exe AutoDeleteOldBackupsDays=0 does not work?
« Reply #3 on: March 18, 2013, 06:55:56 pm »
Ah I remember now..

If Trim$(TextMinToKeep.Text) = "" Then TextMinToKeep.Text = "5"
If Trim$(TextNumOfDays.Text) = "" Then TextNumOfDays.Text = "30"
If Trim$(TextNumOfDays.Text) = "0" Then TextNumOfDays.Text = "30"

The program deletes the backups after a backup is made. So I dont allow 0 to be used as it would delete all of them after the backup is done.

The program takes the date from the name of the folder in the backup location. It then takes that date and does a date diff math to get number of days. Thus if it gets 0 all get deleted. So the program doesnt look at the date modified or anything, it looks at the folder name.

So the trick to do what you want would be this

BackupsToKeep=0
Only1AutoBackupPerDay=1
AutoDeleteOldBackupsDays=1

Which all 3 commands can be used for the Only1AutoBackupPerDay setting.

/silent = minmized window
/supersilent = window stays hidden
/auto = normal window

Now with the Only1AutoBackupPerDay=1 if the program is ran with one of the 3 switches again during the same day it will check the backup folder, see one was made and simply close itself without doing a backup.

If for some reason you need that one backup that was made deleted then it might be easy to just add the del command for the backup folder to remove any.

Shane

Offline Merkas

  • Newbie
  • *
  • Join Date: Mar 2013
  • Posts: 3
  • Karma: 0
    • View Profile
Re: TweakingRegistryBackup.exe AutoDeleteOldBackupsDays=0 does not work?
« Reply #4 on: March 18, 2013, 07:02:33 pm »
Thanks,

I'll add the del to the batch  :smiley:

Added this to the batch file before calling the registry backup;

IF /i EXIST "%InsRegPath%\%computername%" rd /s/q "%InsRegPath%\%computername%">Nul

Works great. Thanks again
« Last Edit: March 18, 2013, 07:31:32 pm by Merkas »

Offline Shane

  • Administrator
  • Hero Member
  • *****
  • Join Date: Sep 2011
  • Posts: 9281
  • Location: USA
  • Karma: 137
  • "Knowledge should be shared not hidden."
    • View Profile
Re: TweakingRegistryBackup.exe AutoDeleteOldBackupsDays=0 does not work?
« Reply #5 on: March 18, 2013, 07:09:01 pm »
Also something that you might like.

The program stores each backup under a folder with the computer name. So you can store multiple backups from other systems to the same folder :-)

I did this for fellow techs who run it from a thumb drive on multiple machines.

So you could have the backups saved to a network location.

Windows by default doesn't allow the reg files to be restore from a network location, I cover that by having the program copy the files over to the system before the restore.

The only draw back of not keeping the reg backups on the same machine is you wont be able to use the bat file restore to use from the recovery console.
http://www.tweaking.com/articles/pages/tweaking_com_registry_backup_online_help,3.html

I only tell you this just in case you ever needed it :-)

Shane