Batch File to Delete oldest Full

Discussion in 'Acronis True Image Product Line' started by feinhorn, Jan 15, 2007.

Thread Status:
Not open for further replies.
  1. feinhorn
    Offline

    feinhorn Registered Member

    @echo off
    for /f %%a in ('dir *.* /b /a-d /o-d') do set Oldest=%%a
    echo Oldest=%oldest%
    del "%Oldest%" /Q /F


    This is cheating but it is working for me. It deletes the oldest full backup in my backup location BEFORE the backup is run!!! This is for people that only do fulls. Have it run in the pre/post command in TI10. This is the only way I would keep my disk from becoming full in the middle of a backup. Hope it helps someone. Reason I created it was because Backup Location rules are only tested AFTER a backup not before. Any additions to this script are welcome!!!
  2. politcat
    Offline

    politcat Registered Member

    hi,
    i want to do a full backup once a week w/o differentials or whatever so if it isn't too much trouble can you give me a step by step on how to use this batch file. (total newbie here)

    thx!
  3. writedom
    Offline

    writedom Registered Member

    Create a backup location in Acronis. Then adjust the settings accordingly. For example maximum number of backups, maximum size allocation, etc.

    Forget the batch, Acronis does this for you.
  4. feinhorn
    Offline

    feinhorn Registered Member

    TI DOES NOT DO THIS FOR YOU. TI will only check if any of the setting in the back location have been violated AFTER.......I SAID AFTER a backup has completed. This means that if you have less disk space then needed for a backup your disk will fill before the quota is exceeded. Even if you set the amount of backups allowed to say three, the fourth backup must complete before the oldest one is deleted.
  5. politcat
    Offline

    politcat Registered Member

    feinhorn?
  6. Bruce Mahnke
    Offline

    Bruce Mahnke Registered Member

    Attention: feinhorn:

    It might be helpful if you could explain a line in your expression that reads as follows:
    [for /f %%a in ('dir *.* /b /a-d /o-d') do set Oldest=%%a].
    There are many folks that will not understand the significance of this. It also appears that this batch file would have to be manually run before creating a manual backup and that if this is true it should be understood by any potential user using a scheduled backup would be a problem. An understanding of the switches applied would be helpful.

    Perhaps an alternative approach would be to select a fixed number of backups to be used. This would have to be defined. Then when the batch file runs do a rename of the existing files bumping their name up one place, ultimately do a delete to delete the oldest file (kind of a drum sequencer). The next backup would then fill the slot of the lowest (perhaps) number.

    Some greater details about your application and how you use it might be helpful to other users. It appears that the driving force here has to do with a backup drive with limited capacity.

    Edit: Just recalled your comment about pre/post commands. Not familiar with that. It it recognized that that may automate the batch file to run prior to running the image- no experience with that.

    Bruce
    Last edited: Jan 16, 2007
  7. CatFan432
    Offline

    CatFan432 Registered Member

    I just would like to express my opinion that Acronis’s design on managing the backups is the correct one. It’s not so important if a user keeps several backups on file, but in the case of a user relying on a single backup, as many do, deleting the current backup before creating a new one leaves one at risk in case of a system crash during creation of the new backup. The Backup Location feature in TI 10 is very versatile as long as the parameters are set up to reflect the amount of space actually available for backups. The best long term solution is overkill on the amount of space set aside for backups, even if it means adding more storage.
Thread Status:
Not open for further replies.