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

Author Message
Leo G.

Guest


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 Smile
Advertisements
martin◆
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 27086
Location: Prague, Czechia
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.
Leo G.

Guest


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.
Log.txt (10.5 KB) [Download]

Description: Session log

martin◆
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 27086
Location: Prague, Czechia
Please read documentation:
https://winscp.net/eng/docs/message_preserve_time_perm

If that does not help, come back.
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