(as in the final post in this thread https://winscp.net/forum/viewtopic.php?t=23824)
but in the docs I read
The method cannot be used via COM interface (i.e. from VBScript, JScript or VBA).
However, the outcome:
How would I check for the existence of a remote file of which I only know part of the name (e.g.
I found that
' passing in "SomeFile_*.CSV" for fileName and a working session Private Function resultExists(fileName As String, ByRef activeSession As Session) As Boolean Dim files As New RemoteFileInfoCollection Dim f As RemoteFileInfo ' error occures when the following statement is executed Set files = activeSession.EnumerateRemoteFiles("/somePath/", fileName, EnumerationOptions_None) resultExists = (files.count > 0) For Each f In files Debug.Print f.Name Next f End Function
The problem doesn't seem to be the call itself but the assignment.
When I merely do
call activeSession.EnumerateRemoteFiles("/somePath/", fileName, EnumerationOptions_None)
I'm on Win10 64bit Enterprise, MS Office 2016 64bit, WinSCPnet.dll (FileVersion 126.96.36.19940, ProductVersion 188.8.131.52)