Topic "How to disable tmp file when runs WinSCP DLL in VB Script"

Author Message
Justin Kuo

Guest


I used the VB Script to call the WinSCP DLL.
The script is the same as the example posted in this web site.
However, the script generated a tmp file under "C:\Users\<username>\AppData\Local\Temp\" folder every time when the script was executed.
The content of the tmp file is below.
Can someone know how to disable the tmp file or delete it after script finished?

<?xml version="1.0" encoding="UTF-8"?>
<session xmlns="http://winscp.net/schema/session/1.0" name="monitor@TRANSFER.QGS.QLD.GOV.AU" start="2015-06-04T23:04:25.228Z">
<group name="open -hostkey=&quot;ssh-rsa 2048 a2:b5:f5:68:18:46:08:38:4d:e2:ad:86:59:f5:8f:66&quot; -timeout=15 &quot;sftp://monitor:123456@TRANSFER.QGS.QLD.GOV.AU&quot;" start="2015-06-04T23:04:25.511Z">
</group>
<group name="stat -- &quot;st11.txt&quot;" start="2015-06-04T23:04:25.708Z">
<stat>
<filename value="/st11.txt" />
<file>
<type value="-" />
<size value="0" />
<modification value="2014-06-01T14:00:00.000Z" />
<permissions value="rw-r--r--" />
</file>
<result success="true" />
</stat>
</group>
<group name="exit" start="2015-06-04T23:04:25.846Z">
</group>
</session>
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24553
Location: Prague, Czechia
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.
Justin Kuo

Guest


prikryl 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
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24553
Location: Prague, Czechia
Please attach a full debug log file showing the problem (using the latest version of WinSCP).

To generate log file, set Session.DebugLogPath. Submit the log with your post as an attachment. If you do not want to post the log publicly, you can mark the attachment as private.
Justin Kuo

Guest


I am using the version 5.0.6 on Windows 2008 R2.
I am not able to update it to the latest version 5.7.3 now.
The debug log is attached for your reference.
WinSCP_debug.log (26.59 KB) Private file

Description: (none)

martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24553
Location: Prague, Czechia
Sorry, but 5.0.6 is an ancient beta version (3 years old), first release of .NET assembly prototype. We cannot really provide a support for that. And you cannot expect it to work correctly.
Justin Kuo

Guest


Hi prikryl,

I upgraded the dll to 5.7.3 then the tmp file was deleted after session disposed.
Thanks for your help.
Very Happy
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24553
Location: Prague, Czechia
Thanks for your feedback!
Advertisements

You can post new topics in this forum






Search Site

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