Page 1 of 1

Run script after..

Posted: Mon Feb 15, 2021 9:56 pm
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.

Re: Run script after..

Posted: Mon Feb 15, 2021 11:12 pm
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

Re: Run script after..

Posted: Tue Feb 16, 2021 5:30 pm
by GeorgB
Hi,

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

Will give it a try.

Thanks