Page 1 of 1

Change one filetype on-the-fly

Posted: Thu Feb 22, 2024 2:26 pm
by a.devecerski
Hello everyone

I would need to make a backup job for a folder structure containing different file types where one of them should be changed in the backup location (for example, all .DOC files should be renamed to .BAK). All the other files should be backed up unchanged.
Is that possible?

Regards

Re: Change one filetype on-the-fly

Posted: Thu Feb 22, 2024 3:22 pm
by tobias
Hello,
yes, you can do this with a PascalScript.

Please see
https://www.syncovery.com/pascalscript/

In the following example, I chose lower case extensions because that's the standard nowadays. However it will recognize an uppercase .DOC extension too.

Code: Select all

function OnReplaceFilenameLeftToRight(const FileName: UnicodeString;
        const isFolder: Boolean):UnicodeString;
begin
  if isFolder then
    Result:=FileName
  else
    if LowerCase(ExtractFileExt(FileName))='.doc' then
       Result:=ChangeFileExt(FileName,'.bak')
    else
        Result:=FileName;
  end;
The script is pasted into the profile via the checkmark "PascalScript..." on the "Job" tab sheet.

Re: Change one filetype on-the-fly

Posted: Fri Feb 23, 2024 9:19 am
by a.devecerski
Hello Tobias, thanks for the quick response

As luck would have it, I need this backup job to run on our backup QNAP NAS (TS-1635AX), with ARM CPU.
And attempting to add Pascal script resulted in "PascalScript is not supported on this CPU type" error message.
I've tested the script on a different, x86 powered, NAS and it works like a charm.

Is there any other way I could accomplish this directly, on the first mentioned NAS?

Thank you for the assistance
Regards

Re: Change one filetype on-the-fly

Posted: Fri Feb 23, 2024 10:15 am
by tobias
Hello,
unfortunately, the PascalScript language is currently not available for 64-bit ARM (AArch64).

I hope it can be implemented, possibly in the second half of 2024.

Re: Change one filetype on-the-fly

Posted: Tue Feb 27, 2024 12:31 pm
by a.devecerski
tobias wrote:
Fri Feb 23, 2024 10:15 am
I hope it can be implemented, possibly in the second half of 2024.
Kind of hoped v10.12.3 upgrade will bring that functionality :(

Thank you Tobias

Re: Change one filetype on-the-fly

Posted: Tue Feb 27, 2024 12:50 pm
by tobias
Hi,
it's not easy, as the following needs to be translated to 64-bit:

https://github.com/modulo7/pascalscript ... ce/arm.inc

I will try to give it a higher priority. I am actually very interested in this. MacOS customers need it too, although for another good while they can just install the Intel version of Syncovery on their Apple Silicon Macs.

Re: Change one filetype on-the-fly

Posted: Tue Feb 27, 2024 1:05 pm
by a.devecerski
tobias wrote:
Tue Feb 27, 2024 12:50 pm
Hi,
it's not easy, as the following needs to be translated to 64-bit:

https://github.com/modulo7/pascalscript ... ce/arm.inc

I will try to give it a higher priority. I am actually very interested in this. MacOS customers need it too, although for another good while they can just install the Intel version of Syncovery on their Apple Silicon Macs.
I'm sure it's not easy (but maybe it was already in preparation or something like that...).
While we're at this, not that it's problem or anything, are there any Release Notes or What's New for new versions or we just look around & try new stuff?
Haven't been able to find them on your site.

Again, thank you very much Tobias