ignore failure and return status code 0 when no file is there at SFTP

Advertisement

DaveKalra
Guest

ignore failure and return status code 0 when no file is there at SFTP

I have three different sftp location where file is coming at specific time .job runs vbscript which runs winscp commands to download files from three different SFTP location .when there is no file at sftp location then job gone to long execution state because status code 1 is coming from vbscript .I want to return status code 1 so that other instance will run .I tried to handle this situation in vbscript but cant do it.Help is really appreciated

Reply with quote

Advertisement

DaveKalra
Guest

ignore failure and return status code 0 when no file is there at SFTP

Hi Martin need your help to resolve this type of issue

Reply with quote

Makc666
Joined:
Posts:
52
Location:
MSK-RU

No one will help until will see the script.

I don't understand why you can't make a code which will look if there any file on the host and if "No" go forward.

Reply with quote

DaveKalra
Guest

ignore failure and return status code 0 when no file is there at SFTP

Makc666 wrote:

No one will help until will see the script.

I don't understand why you can't make a code which will look if there any file on the host and if "No" go forward.


c_commandStr = """C:\Program Files (x86)\WinSCP\WinSCP.com""" & " /command "
c_commandStr = c_commandStr & chr(34) & "open sftp://" & m_strFTPLogin & ":" & m_strFTPPassword & "@" & m_strFTPAddress & chr(34) & " "
c_commandStr = c_commandStr & chr(34) & "cd "& m_strFTPRemoteFolder & chr(34) & " "
c_commandStr = c_commandStr & chr(34) & "option failonnomatch off" & chr(34) & " "
c_commandStr = c_commandStr & chr(34) & "get -delete -nopreservetime " & m_clientFileName & chr(34) & " "
c_commandStr = c_commandStr & chr(34) & "close" & chr(34) & " "
c_commandStr = c_commandStr & chr(34) & "exit" & chr(34) & " "
c_commandStr = c_commandStr & "/log="& m_strLogPath & "sftp_" & ArgObj(0) & "_" & "Tabb_" & m_filedate & ".log"


This above code always return status code 1 when file is not available .added code "failonnomatch off" but log didn't return status code 0

Reply with quote

DaveKalra
Guest

ignore failure and return status code 0 when no file is present at SFTP

Hi marc need your help to resolve the issue

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
28,658
Location:
Prague, Czechia

Re: ignore failure and return status code 0 when no file is there at SFTP

The piece of the code you have posted does not explain, what problem you have with continuing on another server.

Reply with quote

Makc666
Joined:
Posts:
52
Location:
MSK-RU

Re: ignore failure and return status code 0 when no file is there at SFTP

DaveKalra wrote:

This above code always return status code 1 when file is not available .added code "failonnomatch off" but log didn't return status code 0

Try to replace
c_commandStr = c_commandStr & chr(34) & "get -delete -nopreservetime " & m_clientFileName & chr(34) & "
with something like:
  • move all files to another directory which is only for your operations
  • then try to get files from that another folder them without -delete
  • then make rm * on that another folder

Reply with quote

Advertisement

You can post new topics in this forum