Run script after..

English Support for Syncovery on Windows.
Post Reply
GeorgB
Posts: 3
Joined: Mon Feb 15, 2021 9:50 pm

Run script after..

Post by GeorgB »

Hi all,

I wrote a little powershell script to rename a file after it was copied but don`t think Syncovery supports powershell scripts?

Hence the question, anybody have an idea how to achive the renaming in whatever sript langue supported?

All I need is to rename a file called Hig2.hcw to Hig2_[date in ddmmyy format].hcw

Pretty simple really, if you kow how.

or, alternately, how can I get my powershell script to run?
tried just the path & script name, and powershell path & script name, none worked

Tx.

tobias
Posts: 1604
Joined: Tue Mar 31, 2020 7:37 pm

Re: Run script after..

Post by tobias »

Hello,
ideally, this would be done with a PascalScript like the following. You can enter it in the profile via the PascalScript checkmark on the Job tab sheet.

See also: https://www.syncovery.com/pascalscript

Code: Select all

function OnReplaceFilenameLeftToRight(const FileName: UnicodeString;
        const isFolder: Boolean):UnicodeString;
begin
  if isFolder then
    Result:=FileName
  else
    Result:=ChangeFileExt(FileName,'')+'_'+DateTimeToStrWithFormat(Now,'ddmmyy')+ExtractFileExt(FileName);
  end;
To actually run a Powershell script, you need to use a command line similar to this:

Code: Select all

PowerShell.exe -Command C:\scripts\test.ps1

GeorgB
Posts: 3
Joined: Mon Feb 15, 2021 9:50 pm

Re: Run script after..

Post by GeorgB »

Hi,

Thank you, I missed the " -Command " between my powershell and the script.

Will give it a try.

Thanks

Post Reply