Back to product page
- Introduction
- License agreement
- Classes
- Enumerations
- Exceptions
- WeOnlyDo.Client.FtpDLX
- Properties
- Authentication
- Blocking
- BufferSize
- Certificate
- Compression
- DirFormat
- DirItems
- Encryption
- Hostname
- KeepAlive
- LastError
- ListItem
- ListParams
- LocalPath
- Login
- MaxTransferRate
- Passive
- Password
- Port
- PreserveDates
- PrivateKey
- Protocol
- ProxyHostname
- ProxyLogin
- ProxyPassword
- ProxyPort
- ProxyType
- PublicKeyOpenSSH
- PublicKeySSH
- RemotePath
- Resume
- SecureMethod
- SmartGet
- SmartPut
- State
- StrictHost
- Tag
- Timeout
- Timezone
- TransferMode
- TransferRate
- TransferTime
- UseIPv6
- Version
- Methods
- Events
- Properties
- WeOnlyDo.Client.DirItemsCollection
- WeOnlyDo.Client.DirItem
- How to get support?
LoopItemEvent event
Fires before wodFtpDLX.NET performs operation on file from the GetFiles/PutFiles/DeleteFiles/LoopFiles sequence.
Syntax
- C#
- VB.NET
delegate void LoopDelegate(object Sender, FtpLoopArgs Args);
The LoopItemEvent(Args.Error,Args.ItemType,Args.LocalFile,Args.RemoteFile,Args.Skip) syntax has these parts:
The LoopItemEvent(Args.Error,Args.ItemType,Args.LocalFile,Args.RemoteFile,Args.Skip) syntax has these parts:
Args.Error | Exception. Contains exception object, if error occurred. |
Args.ItemType | DirItemTypes enumeration. Type of the item - file, folder, symbolic link. |
Args.LocalFile | String. Full path to file/folder on local disk. |
Args.RemoteFile | String. Full path to file/folder on remote server. |
Args.Skip | Boolean. When set to True then intended operation is not performed on the item. |
Delegate Sub LoopDelegate(ByVal Sender As Object, ByVal Args As FtpLoopArgs)
The LoopItemEvent(Args.Error,Args.ItemType,Args.LocalFile,Args.RemoteFile,Args.Skip) syntax has these parts:
The LoopItemEvent(Args.Error,Args.ItemType,Args.LocalFile,Args.RemoteFile,Args.Skip) syntax has these parts:
Args.Error | Exception. Contains exception object, if error occurred. |
Args.ItemType | DirItemTypes enumeration. Type of the item - file, folder, symbolic link. |
Args.LocalFile | String. Full path to file/folder on local disk. |
Args.RemoteFile | String. Full path to file/folder on remote server. |
Args.Skip | Boolean. When set to True then intended operation is not performed on the item. |
Remarks
This event fires as 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 Args.LocalFile and Args.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 event like this:
Private Sub Ftp1_LoopItemEvent(ByVal Sender As Object, ByVal Args As WeOnlyDo.Client.FtpLoopArgs) Handles Ftp1.LoopItemEvent
If Args.ItemType = WeOnlyDo.Client.DirItemTypes.Directory Then
Args.Skip = False
Else
If Args.RemoteFile.EndsWith(".txt") Then
Args.Skip = False
Else
Args.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 Ftp1_LoopItemEvent(ByVal Sender As Object, ByVal Args As WeOnlyDo.Client.FtpLoopArgs) Handles Ftp1.LoopItemEvent
If Args.RemoteFile.EndsWith(".txt") Then
Args.LocalFile = "c:\mytxtfiles\file" & Counter & ".txt"
Counter = Counter + 1
Args.Skip = False
Else
Args.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.