Add Mirror/Sync to Backup

Features wanted...
Locked
Stephen
Posts: 3
Joined: 31 Jul 2011 23:21

Add Mirror/Sync to Backup

Post 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

highend
Posts: 14634
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Add Mirror/Sync to Backup

Post 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>, "|"); }
    }
One of my scripts helped you out? Please donate via Paypal

admin
Site Admin
Posts: 65221
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Add Mirror/Sync to Backup

Post by admin »

FYI, Sync will be the next big feature.

Sebbel
Posts: 12
Joined: 29 Jul 2014 14:53
Location: Germany

Re: Add Mirror/Sync to Backup

Post by Sebbel »

Great news! I'm so excited. :) :tup:

prino
Posts: 354
Joined: 18 Mar 2012 21:14
Location: Vilnius, Lithuania
Contact:

Re: Add Mirror/Sync to Backup

Post 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!
Robert AH Prins
robert.ah.prins @ the.17+Gb.Google thingy
At last, a tiny bit of programming here... :mrgreen:

admin
Site Admin
Posts: 65221
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Add Mirror/Sync to Backup

Post by admin »

That looks like a job for a little script. (Of course, sync will also be included in scripting.)

admin
Site Admin
Posts: 65221
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Add Mirror/Sync to Backup

Post by admin »

FYI, the discussion continues in this thread: viewtopic.php?p=152035#p152035

This thread here is locked now.

Locked