The WinSCP command line in VB Script pulls one record at a time

Advertisement

Leo G.
Guest

The WinSCP command line in VB Script pulls one record at a time

Hello there,

I have a problem utilizing a PutFiles command in my script. It picks up only one file at a time instead of taking all files in the directory as specified. However, GetFiles pulls all files. Please, please, please advise A.S.A.P. Following is the part of the script I have a problem with:

Do while true
if ie.document.all("continue").Value = "no" then
ie.Quit
exit Do
end if

If DateDiff("s", lastRunTime, curDateTime) > 60 then
If Minute(curDateTime) = 29 or Minute(curDateTime) = 59 Then

' ----- Upload files
Set transferResult = session.PutFiles(localOrdersDir & "*.*", remoteOrdersDir, False, transferOptions)
' Throw on any error
transferResult.Check
' Print results
For Each transfer In transferResult.Transfers
objFSO.MoveFile transfer.filename, localOrdersDir & "transmitted\"
objLogFile.WriteLine("Uploading " & Replace(transfer.filename, "\\MSL-SERVER\SchuyLab\schuylab\Labcorp\Labcorp orders\", "") & " completed on " & CStr(now()))
'WScript.Echo "Upload of " & transfer.FileName & " succeeded"
Next
Set transferResult = Nothing

' ----- Download files
Set transferResult = session.GetFiles(remoteResultsDir & "*.*", localResultsDir, False, transferOptions)
' Throw on any error
transferResult.Check
' Print results
For Each transfer In transferResult.Transfers
'WScript.Echo "Download of " & transfer.FileName & " succeeded"
objLogFile.WriteLine("Downloading " & Replace(transfer.filename, remoteResultsDir,"") & " completed on " & CStr(now()))
Next
Set transferResult = Nothing
lastRunTime = Now()
End If
End IF
WScript.Sleep 1000
curDateTime = Now()
Loop

Thank you in advance for your helpful advise :-)

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
29,760
Location:
Prague, Czechia

Re: The WinSCP command line in VB Script pulls one record at a time

Please attach a full session log file showing the problem (using the latest version of WinSCP).

To generate the session log file, set Session.SessionLogPath. Submit the log with your post as an attachment. Note that passwords and passphrases not stored in the log. You may want to remove other data you consider sensitive though, such as host names, IP addresses, account names or file names (unless they are relevant to the problem). If you do not want to post the log publicly, you can mark the attachment as private.

Reply with quote

Leo G.
Guest

Re: The WinSCP command line in VB Script pulls one record at a time

Hi Martin,

First of all, I would like to thank you for your advise. Sorry, it takes me a while to upgrade the WinSCP, re-register DLLs and modify the script.
According to the log file (attached), session.PutFiles in my script tries to change file's attribute on the remote server for each transmitted file. I think that is a reason why the script does not pickup other files in local directory. Would you please suggest how to prevent session.PutFiles changing the attributes? As of now, I just ignore permissions errors.
Thanks a lot for your great support.
Regards,

Leo.
Description: Session log

Reply with quote

Advertisement

You can post new topics in this forum