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

Author Message
DaveKalra

Guest


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
Advertisements
DaveKalra

Guest


Hi Martin need your help to resolve this type of issue
Makc666
[View user's profile]

Joined: 2016-12-08
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.
DaveKalra

Guest


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
DaveKalra

Guest


Hi marc need your help to resolve the issue
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 26514
Location: Prague, Czechia
The piece of the code you have posted does not explain, what problem you have with continuing on another server.
Makc666
[View user's profile]

Joined: 2016-12-08
Posts: 52
Location: MSK-RU
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
Advertisements

You can post new topics in this forum






Search

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License