Page 1 of 1

Backup once every 2nd week

Posted: Tue Dec 07, 2021 10:40 am
by Lars
Hello,

I'm looking for a way to elegantly have a weekly chained backup to two different switching target folders. The " $2WEEKSDAYS" variable comes close. But due to the fact that the chained backups might take longer, the weekdays the idividual backups start are not set. I was woundering if there is some variable one youd use fpr odd and even weeks of the year?


Regards, Lars

Re: Backup once every 2nd week

Posted: Fri Dec 10, 2021 1:15 pm
by tobias
Hello,
sorry for the delay, it is possible with a PascalScript. I will post one ASAP.

Re: Backup once every 2nd week

Posted: Thu Jan 20, 2022 3:16 pm
by Lars
Hi,

I would still be interested in a possible sollution?

Regards, Lars

Re: Backup once every 2nd week

Posted: Thu Jan 20, 2022 3:44 pm
by tobias
Hello,
again sorry for the delay. I can send you a script and/or Syncovery update today.

So the destination path would alternate every 7 days between for example
D:\Data\ODD
and
D:\Data\EVEN ?

Is that correct? Or how would you like the odd/even folders named?

Also, does your week start on a Monday or Sunday?

Re: Backup once every 2nd week

Posted: Mon Jan 31, 2022 5:31 pm
by tobias
Hello,
OK here's a sample script that adds ODD and EVEN to the end of the right-hand path, alternating every 7 days. It's not necessarily the same odd/even of the official week of the year, but it alternates correctly across years.

In this function, a new week starts every Monday.

If the right-hand path uses forward slashes, such as for FTP or cloud paths, you need to replace the backslashes in the function with forward ones.

Code: Select all

function OnGetProfilePathBeforeListing(const isRightSide:Boolean;
        var Path,UserName,Password:UnicodeString;
        var AuthKey,AuthKeyPassword:AnsiString;
        var Port:Integer):Boolean;
var today:Integer;
begin
  if isRightSide then begin
     today:=Trunc(Now)-2;
     if (today div 7) mod 2=1 then
        Path:=ConcatPathWithDelim(Path,'ODD','\')
     else
        Path:=ConcatPathWithDelim(Path,'EVEN','\');
     end;
  Result:=true;
  end;

Re: Backup once every 2nd week

Posted: Sun Feb 06, 2022 6:17 pm
by Lars
Tank you! I will have a look and test it.