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?
PutFiles method
Uploads multiple files in a sequence, recursive.
Type
VoidSyntax
- C#
- VB.NET
public Void PutFiles();
public Void PutFiles(Int32 MaxLevel);
The PutFiles(MaxLevel) syntax has these parts:
public Void PutFiles(String LocalPath, String RemotePath, Int32 MaxLevel);
The PutFiles(LocalPath,RemotePath,MaxLevel) syntax has these parts:
public Void PutFiles(Int32 MaxLevel);
The PutFiles(MaxLevel) syntax has these parts:
MaxLevel | Specifies maximum number of subdirectory levels to copy. 0 for unlimited. |
public Void PutFiles(String LocalPath, String RemotePath, Int32 MaxLevel);
The PutFiles(LocalPath,RemotePath,MaxLevel) syntax has these parts:
LocalPath | Holds full path on local disk from where files are uploaded. |
RemotePath | Holds full path on the server where files are uploaded. |
MaxLevel | Specifies maximum number of subdirectory levels to copy. 0 for unlimited. |
public Sub PutFiles()
public Sub PutFiles(ByVal MaxLevel As Int32)
The PutFiles(MaxLevel) syntax has these parts:
public Sub PutFiles(ByVal LocalPath As String, ByVal RemotePath As String, ByVal MaxLevel As Int32)
The PutFiles(LocalPath,RemotePath,MaxLevel) syntax has these parts:
public Sub PutFiles(ByVal MaxLevel As Int32)
The PutFiles(MaxLevel) syntax has these parts:
MaxLevel | Specifies maximum number of subdirectory levels to copy. 0 for unlimited. |
public Sub PutFiles(ByVal LocalPath As String, ByVal RemotePath As String, ByVal MaxLevel As Int32)
The PutFiles(LocalPath,RemotePath,MaxLevel) syntax has these parts:
LocalPath | Holds full path on local disk from where files are uploaded. |
RemotePath | Holds full path on the server where files are uploaded. |
MaxLevel | Specifies maximum number of subdirectory levels to copy. 0 for unlimited. |
Remarks
This method will try to upload local directory structure from local disk to the server. You need to specify LocalPath argument that points to a directory from where files are copied, and RemotePath that determines location where those files are placed on the server. PutFiles will go and recursive copy directories and files - corresponding directory structure will also be created on the server.wodFtpDLX.NET will go up to MaxLevel deep into recursion. Default value is 5 - meaning up to 5 subdirectory levels will be copied. You can specify any value for MaxLevel. If you specify 0, that means that no restriction exists for recursion depth.
Before each item is copied, LoopItem event will be fired, specifying local name of the file/folder, its remote name (including full path in both cases), type of the item (file/folder) and will allow you to Args.Skip the item so it is not copied to the server at all. Make sure your logic for setting Skip = True is correct - if you skip creation of remote directory and then try to upload files to it, you may get more errors! Since PutFiles does not support wildcards (for example, you cannot specify "*.TXT" in PutFiles call), LoopItem event is a place to determine if certain item matches your wildcard expression (if you have any), so you can skip files that doesn't match your criteria.
If an errors occurs during file upload, LoopError event is fired holding error number and error description of the error. If you leave Args.Error argument in LoopError event as is - PutFiles operation will be aborted. If you change Args.Error value in LoopError event to 0, then PutFiles operation will continue (ignoring the error) normally.
Please note that using PutFiles in blocking environment where events are not available is almost impossible to use - simply because first error that occurs may abort the operation, and there is no way to ignore the error (since you don't have access to LoopError event).
Do not forget that RemotePath should always specify full absolute path (i.e. /home/joe/something) instead of relative path (i.e. joe/something). LocalFile should also specify full path (i.e. C:\home\joe\something) instead of relative path (i.e. joe\something).