sftp
sftp copied to clipboard
Retry if download fails
Is there a way to retry to download a file if sftp_download fails the first time?
I recommend that you solve that by making your call to sftp_download inside a control structure like while-loop, which starts all over again until a certain condition is met. Also, the reason for a failure could be several, such as the file not found or connection time out. They best way to handle a failed download will depend on what the reason for the failure was. For example, if it is an actual error message that you want to handle, you proably want to write something with tryCatch().
I saw that sftp_<...> functions allow curl_options as parameter. I'm wondering if passing the --retry-all-errors parameter as explained here would cause the function doing retry. I'll try it asap.