martin wrote:
You cannot disable the temporary XML log, it's needed for the assembly to work. And the log should get deleted automatically, when the Session
object is disposed.
Hi Thanks for your reply.
But the tmp file didn't be deleted after the session object was disposed.
The tmp files caused the folder reached the limitation of Windows file count.
So my script stopped because no more tmp file could be generated.
My script is following.
Option Explicit
' Setup session options
Dim sessionOptions
Set sessionOptions = CreateObject("WinSCP.SessionOptions")
With sessionOptions
.Protocol = .Protocol
.HostName = "TSTTRANSFER.COM.AU"
.UserName = "u_monitor"
.Password = "123456"
.SshHostKey = "ssh-rsa 2048 c7:e9:40:70:f9:54:54:7c:ac:74:6c:75:a7:f4:32:8c"
End With
Dim session
Set session = CreateObject("WinSCP.Session")
Dim DateFile
DateFile = formatdatetime(NOW(),1)
Dim LogFile
LogFile = "C:\Program Files\WinSCP\tstscp_" & DateFile & ".log"
session.SessionLogpath = LogFile
session.DebugLogpath = DebugLog
' Connect
On Error Resume Next
session.Open sessionOptions
If Err.Number <> 0 Then
FireActions = True
Details = "Connection Failed. Please Check Logs."
Err.Clear
Else
' Upload files
Dim transferOptions
Set transferOptions = WScript.CreateObject("WinSCP.TransferOptions")
transferOptions.TransferMode = TransferMode_Binary
Dim transferResult
Set transferResult = session.PutFiles("c:\temp\Axway_test\*", "/", False, transferOptions)
' Throw on any error
transferResult.Check
' Print results
Dim transfer
For Each transfer In transferResult.Transfers
' WScript.Echo "Upload of " & transfer.FileName & " succeeded"
Next
End If
' Disconnect, clean up
session.Dispose