Page 1 of 1

Add Mirror/Sync to Backup

Posted: 17 Dec 2016 17:50
by Stephen
Is it possible to add a new function to perform the Backup operation but to additionally delete any files from the destination folder that are no longer present in the source folder. Usage scenario is two usb external hard drives, one live edited and the second to be a mirror backup. Connect both drives and then rather than using "Backup Here" have another option of "Mirror Here" or "Sync Here" for instance. Would probably want a decent confirmation dialog due to the deletion of files!

For instance:
  1. Source\Test\ contains File1.txt and File2.txt
  2. Using "Backup Here" to a Destination folder without the "Test" folder will replicate the structure exactly
  3. If we delete File2.txt and add File3.txt to Source, using "Backup Here" to Destination folder which already contains File1.txt and File2.txt will result in the addition of File3.txt and File2.txt would remain
  4. The Mirror option would delete File2.txt as it is no longer present in Source folder
I did think this could be done using a script, but haven't got around to giving it a go! This was raised previously in another thread viewtopic.php?f=3&t=7659

Re: Add Mirror/Sync to Backup

Posted: 17 Dec 2016 18:27
by highend
To get something equivalent (for files!) now you could use a script after your backupto command execution...

Code: Select all

    $aPath  = get("Path");
    $iPath  = get("Path", "i");
    $aFiles = replace(quicksearch("/f", $aPath), $aPath);
    $iFiles = replace(quicksearch("/f", $iPath), $iPath);
    $pattern = regexreplace($aFiles, "(#|\[)", "[$1]");
    $delete  = formatlist($iFiles, "ef", <crlf>, "!$pattern");
    if ($delete) {
        $delete = regexreplace($delete, "^\\", "$iPath\");
        $number = gettoken($delete, "count", <crlf>);
        $message = <<<>>>
Do you want to delete $number file(s) in
target that do NOT exist in source?
>>>;
        if (confirm($message)) { delete 1, 0, replace($delete, <crlf>, "|"); }
    }

Re: Add Mirror/Sync to Backup

Posted: 28 Jan 2017 09:52
by admin
FYI, Sync will be the next big feature.

Re: Add Mirror/Sync to Backup

Posted: 28 Jan 2017 14:04
by Sebbel
Great news! I'm so excited. :) :tup:

Re: Add Mirror/Sync to Backup

Posted: 30 Jan 2017 21:52
by prino
admin wrote:FYI, Sync will be the next big feature.
Could you set up a questionnaire as to what people would like to see included, so that you can include any big wishes straight from the start, rather than have to bolt them on later? For me the big one would be to be able to sync to two devices simultaneously, so that when one backup fails, I still have a second. Doing it simultaneously, or with a delay of one or two files would also enable very efficient use of the cache, making the second sync take very little additional time!

Re: Add Mirror/Sync to Backup

Posted: 31 Jan 2017 09:43
by admin
That looks like a job for a little script. (Of course, sync will also be included in scripting.)

Re: Add Mirror/Sync to Backup

Posted: 05 Sep 2017 10:42
by admin
FYI, the discussion continues in this thread: viewtopic.php?p=152035#p152035

This thread here is locked now.