No announcement yet.

Mirror / Update hybrid - any way to accomplish with scripts?

  • Filter
  • Time
  • Show
Clear All
new posts

  • Mirror / Update hybrid - any way to accomplish with scripts?

    To back up a drive with continually changing content, I'd like to create a "hybrid" between mirror and update.
    • Mirror is desirable because the current state of the primary drive is maintained. If primary fails, just copy the mirror onto the primary's replacement.
    • Update is desirable because it keeps everything that was on the main drive. If a file is inadvertently deleted off the main drive, it is still on the backup. However, the backup drive soon gets full and requires manual maintenance.

    Here's how my hybrid scheme could work. The Mirror image is maintained in a specific base folder on the backup drive: MIRROR. BC can already do this just fine. However, any file that needs to be deleted is not simply deleted on the target drive; it is moved to an alternate folder tree under a different base folder: DELETED. The DELETED folder is maintained on a first-in, first-out basis. If the drive is full, files are actually deleted in the DELETED tree until sufficient space is available for the new files that need to be copied. If the backup drive is larger than the source, a considerable amount of "history" could be maintained.
    This is basically how the Windows "Recycle Bin" is supposed to work (with caveats), but I don't think BC can use that over a network connection.

    So in summary the hybrid mirror would work like this:

    1) perform folder compare
    2) move any files on target that were deleted on source to DELETED tree on target. (guaranteed to fit on target drive)
    3) Compare size of new files to copy from source to target with space available on target
    4) If insufficient space available, delete necessary number of files from DELETED structure, oldest first.
    5) Copy new and updated files from source to target.

    In my use case, there few (if any) updated files. If updated files needed protection from possible corruption, files about to be updated could also be moved into DELETED before mirroring from the source.

    Is there any way this can be accomplished with BC4 using scripts?
    Last edited by timg11; 30-Dec-2014, 03:48 PM.

  • #2
    Sorry, it isn't possible to do this with Beyond Compare. If you have advanced backup needs, you might want to look into dedicated backup software instead of a general purpose tool like BC.

    There are some features in Beyond Compare that get you partway to what you describe. In "Tools > Options", go to the Backups section. You can check "Backup files before copy" and "Backup files before save" to keep one old version of files you overwrite. BC doesn't have a built in setting to backup deleted files, other than deleting to the recycle bin for local disks.

    You can use a script to move files to be deleted to an alternate folder, however BC doesn't have a way to automatically delete those files if you're running low on disk space.

    Example script:

    load c:\folder d:\backup
    expand all
    select rt.orphan.files
    moveto right path:base d:\backup-deleted
    sync mirror:left->right

    The above script will move files that mirror will delete to the "backup-deleted" folder. However, once you run out of disk space it will just fail with an out of disk space error rather than cleaning up the contents of "backup-deleted".
    Chris K Scooter Software