I need suggestion on how to increase the execution time for 'Move file over SFTP' smart node

I have a Process model where the flow of nodes is like this: I am sending a file to SFTP temporary folder, and adding a delay time node for 10 seconds and next i am using a Rename and Move file over SFTP smart node where i am renaming the file and then moving it from temporary SFTP folder to another permanent folder. At this point, the system is throwing the below error:

'Error renaming file in the remote server. See application server log for more details. Error Message: Specified file path is invalid.'

My guess here is that the file is not having enough time to move from one folder to another, because if I just restart the node its working fine. How do i add a delay in the 'Rename and Move File Over SFTP' so that the file will have enough time to move from one folder to another. 

  Discussion posts and replies are publicly visible

  • 0
    Certified Lead Developer
    Error renaming file in the remote server.

    With the error it seems even rename is failing. If the path given to temporary sftp folder is incorrect then system wont be able to find the file to rename. It might also be possible that the 10s delay is not enough. So check the path of temporary folder for any invalid character or increase the delay to 30s or something more to see if it works!

    Also, if you want to rename ultimately you can rename within Appian using Edit Document smart service and then send to temporary folder/move to expected folder directly. What is the reason for not renaming beforehand? 

  • 0
    Certified Lead Developer

    Implement a file existence check with retry logic, create a loop structure in your process model. After your initial 10-second delay node, add a "Get Remote Directory Contents Over SFTP" smart service configured to list files in your temporary folder. Store the output in a process variable (e.g., pv!fileList).
    Next, add an XOR gateway that checks if your specific file exists in the returned list using a condition like contains(pv!fileList, pv!fileName).
    If the file exists (true path), proceed to the "Rename and Move File Over SFTP" node. If the file doesn't exist (false path), route to a Timer node set for 5 seconds, then loop back to the "Get Remote Directory Contents Over SFTP" node to check again.
    To prevent infinite loops, maintain a counter variable (pv!retryCount) that increments with each iteration, and add a second condition in your XOR gateway to exit the loop after 5-6 attempts.
    This approach ensures the file is fully written and available in the SFTP location before attempting the rename operation.