LoopItem doesn't work with GetFiles (WODFTPDLX) - WeOnlyDo Discussion board

LoopItem doesn't work with GetFiles (WODFTPDLX) (wodSFTP / wodSFTP.NET / wodSFTPdll)

by stamman, Friday, May 25, 2007, 13:39 (6204 days ago)

Hello Everybody,

I'm creating a vbs file, wich I want to start (doubleclick). I only want to download all of the *.txt files from the RemoteDir and put them in a local directory. Directories present on the Remote Site and other files in those directories may not be downloaded.
Files in remotesite:

/TestIN/DSV/
/TestIN/DSV/20070525122500.txt
/TestIN/DSV/20070525133200.txt
/TestIN/DSV/20070525122500/123456/123456.txt
/TestIN/DSV/20070525122500/123456/123456.tif
/TestIN/DSV/20070525133200/456789/456789.txt
/TestIN/DSV/20070525133200/456789/456789.tif

Thus, I only want /TestIN/DSV/20070525122500.txt and /TestIN/DSV/20070525133200.txt to be downloaded (and not the other files and no dirs).

Code:

Option Explicit
Dim objFTP
Set objFTP = WScript.CreateObject( WeOnlyDo.wodFtpDLXCom.1 , wod_ )

objFTP.Hostname = 132.465.666.22
objFTP.Login = login
objFTP.Password = passwd
objFTP.Blocking = 1
objFTP.Connect

objFTP.GetFiles D:MDC_DSVFATAGIScontrole , /TestIN/DSV/ , 1

objFTP.Disconnect

Sub wod_Connected(ErrorCode, ErrorText)
WScript.Echo Connected & ErrorText
End Sub

Sub wod_LoopItem(LocalFile, RemoteFile, ItemType, Skip)
If ItemType = 0 Then
Skip = False
Else
If Right(RemoteFile, 4) = .txt Then
'If Right$(RemoteFile, 4) = .txt Then

Skip = True
End If
End If
End Sub

Sub wod_Disconnected()
WScript.Echo Disconnected
End Sub

When I use the $ after Right, the script crashes. When I do using the code above, everything is downloaded, wich I do not want.

Please help me.

Re: LoopItem doesn't work with GetFiles (WODFTP

by wodDamir, Friday, May 25, 2007, 13:52 (6204 days ago) @ stamman

Hi,

Since you are writing a vbs script, you can't use the Skip parameter. That's actually a limitation on vbs, where you can't set paraameters to affect the component.

For that reason, we have implemented ItemSkip Property which you should use instead of Skip parameter.

You can use it like this:

ftp1.ItemSkip = True

Can you try it and tell me the result?

Regards,
Damba