Variable uses an Automation type not supported in VBScript

Advertisement

nyhack44
Joined:
Posts:
2

Variable uses an Automation type not supported in VBScript

Hi,

I am trying to use the VBScript ListDirectory example and I am getting an error:

Variable uses an Automation type not supported in VBScript
Line 31

Line 31 is :

WScript.Echo fileInfo.Name & " with size " & fileInfo.Length & _
", permissions " & fileInfo.FilePermissions & _
" and last modification at " & fileInfo.LastWriteTime


Can someone please tell me if I am doing something wrong? I use VB script in WSF files for getting and putting files all the time, and they work fine. For the life of me, I can't get list directory to work.

Thanks,

Mark

<job>                                                               
<reference object="WinSCP.Session"/>
<script language="VBScript">
 
Option Explicit
 
' Setup session options
Dim sessionOptions
Set sessionOptions = WScript.CreateObject("WinSCP.SessionOptions")
With sessionOptions
    .Protocol = Protocol_Sftp
    .HostName = <hostname>
    .UserName = <username>
    .Password = <password>
    .SshHostKeyFingerprint = <SSH Key>
End With
 
Dim session
Set session = WScript.CreateObject("WinSCP.Session")
 
' Connect
session.Open sessionOptions
 
Dim directoryInfo
Set directoryInfo = session.ListDirectory("/home/martin/public_html")
 
Dim fileInfo
For Each fileInfo In directoryInfo.Files
    WScript.Echo fileInfo.Name & " with size " & fileInfo.Length & _
        ", permissions " & fileInfo.FilePermissions & _
        " and last modification at " & fileInfo.LastWriteTime
Next
 
' Disconnect, clean up
session.Dispose
 
</script>
</job>    

Reply with quote

Advertisement

You can post new topics in this forum