Q: Execute Command, continuing on error. I have a rule which moves a file from one win folder to another win folder and then runs a CMD against it. If the CMD errors out it keeps retrying the file. How do I move the failed file to another folder on the error and NOT retry it with the command line?
My current setup is:
- WIN as Source
- Destinations:
- WIN
- CMD (Execute Command)
A: In our latest version v2022.6.2.0 we added a new ‘Redirect ExitCode to PS Integer Var A (%VIA)’ option. Please check the ‘Advanced Tab’ of the CMD (Command) as Destination. Enable this option to transfer the ExitCode to our Pascal Script Integer Var psVIA. We’ll use the psVIA var to move the source file in case the Command returns a value <> 0 (which normally is an errorcode).
We will need a third ‘Pascal Script’ as Destination.
Const ctErrorPath = 'C:\3ProcessError\'; // must end with a / Begin psExitCode:= 1; // ... add your code here If psVIA <> 0 Then Begin psMoveFile(psFilePath + psFileName, ctErrorPath + psFileName); psLogwrite(1, '', 'CMD ExitCode Error, psVIA: ' + IntToStr(psVIA)); End; End.
#Filetransfer #Filemanagement
If you need any info about this ‘continuing on error’ request, please let us know.
Best regards,
Limagito Team