Back to product page

LoopItem method


Called before wodFtpDLX performs operation on file from the GetFiles/PutFiles/DeleteFiles/LoopFiles sequence.

Type

None

Syntax

  • Basic
object.LoopItem Owner, LocalFile, RemoteFile, ItemType, Skip
The LoopItem(object,Owner,LocalFile,RemoteFile,ItemType,Skip) syntax has these parts:
objectAn expression evaluating to an object of type IwodFtpNotify.
OwnerA wodFtpDLXCom object.
LocalFileA String value. Full path to file/folder on local disk.
RemoteFileA String value. Full path to file/folder on remote server.
ItemTypeA DirItemTypes enumeration, as described in settings. Type of the item - file, folder, symbolic link.
SkipA Boolean value. When set to True then intended operation is not performed on the item.

Remarks

This method is called only if you implemented IwodFtpNotify interface in your application, and wodFtpDLX.Notification property has received reference to instance of your implementation.

This notification method is called as a result of GetFiles, DeleteFiles, PutFiles and LoopFiles methods. It provides information about each item in the sequence (meaning file or folder) before actual operation on that item is executed - allowing you to optionally Skip the operation for this particular item.

Since both LocalFile and RemoteFile arguments can be changed, you can also cause operation to be performed on completely different files than it would be in original operation.

For example, you can use LoopItem notification like this:
 
Private Sub IwodFtpNotify_LoopItem(ByVal Owner As wodFtpDLXComLib.IwodFtpDLXCom, LocalFile As String, RemoteFile As String, ByVal ItemType As wodFtpDLXComLib.DirItemTypes, Skip As Boolean)
   If ItemType = typeDirectory Then
       Skip = False
   Else
        If Right$(RemoteFile, 4) = ".txt" Then
           Skip = False
        Else
           Skip = True
        End If
   End If
End Sub
 

which means that only files ending with ".txt" are copied - others are skipped (but directories are created, just in case).

You can also use it like this: we will copy all ".txt" files to the same directory, no matter where they originate from:
 
Private Sub IwodFtpNotify_LoopItem(ByVal Owner As wodFtpDLXComLib.IwodFtpDLXCom, LocalFile As String, RemoteFile As String, ByVal ItemType As wodFtpDLXComLib.DirItemTypes, Skip As Boolean)
   If Right$(RemoteFile, 4) = ".txt" Then
       LocalFile = "c:\mytxtfiles\file" & Counter & ".txt"
       Counter = Counter + 1
       Skip = False
   Else
       Skip = True
   End If
End Sub
 

above sample will not create directory structure at all - but still would copy all .txt files to differently named files on local disk.

Platforms

Windows