FtpUpload@2 - FTP upload v2 task

Use this task to upload files to a remote machine using FTP or securely with FTPS.

Syntax

# FTP upload v2
# Upload files using FTP.
- task: FtpUpload@2
  inputs:
    credentialsOption: 'serviceEndpoint' # 'serviceEndpoint' | 'inputs'. Alias: credsType. Required. Authentication Method. Default: serviceEndpoint.
    serverEndpoint: # string. Required when credsType = serviceEndpoint. FTP Service Connection. 
    #serverUrl: # string. Required when credsType = inputs. Server URL. 
    #username: # string. Required when credsType = inputs. Username. 
    #password: # string. Required when credsType = inputs. Password. 
    #implicitFTPS: false # boolean. Use implicit FTPS. Default: false.
    rootDirectory: # string. Alias: rootFolder. Required. Root folder. 
    filePatterns: '**' # string. Required. File patterns. Default: **.
    remoteDirectory: '/upload/$(Build.BuildId)/' # string. Alias: remotePath. Required. Remote directory. Default: /upload/$(Build.BuildId)/.
  # Advanced
    #enableUtf8: false # boolean. Enable UTF8 support. Default: false.
    #clean: false # boolean. Delete remote directory. Default: false.
    #cleanContents: false # boolean. Optional. Use when clean = false. Clear remote directory contents. Default: false.
    #preservePaths: false # boolean. Preserve file paths. Default: false.
    #trustSSL: false # boolean. Trust server certificate. Default: false.
    #customCmds: # string. FTP Commands.
# FTP upload v2
# Upload files using FTP.
- task: FtpUpload@2
  inputs:
    credentialsOption: 'serviceEndpoint' # 'serviceEndpoint' | 'inputs'. Alias: credsType. Required. Authentication Method. Default: serviceEndpoint.
    serverEndpoint: # string. Required when credsType = serviceEndpoint. FTP Service Connection. 
    #serverUrl: # string. Required when credsType = inputs. Server URL. 
    #username: # string. Required when credsType = inputs. Username. 
    #password: # string. Required when credsType = inputs. Password. 
    rootDirectory: # string. Alias: rootFolder. Required. Root folder. 
    filePatterns: '**' # string. Required. File patterns. Default: **.
    remoteDirectory: '/upload/$(Build.BuildId)/' # string. Alias: remotePath. Required. Remote directory. Default: /upload/$(Build.BuildId)/.
  # Advanced
    #enableUtf8: false # boolean. Enable UTF8 support. Default: false.
    #clean: false # boolean. Delete remote directory. Default: false.
    #cleanContents: false # boolean. Optional. Use when clean = false. Clear remote directory contents. Default: false.
    #preservePaths: false # boolean. Preserve file paths. Default: false.
    #trustSSL: false # boolean. Trust server certificate. Default: false.
    #customCmds: # string. FTP Commands.
# FTP upload v2
# Upload files using FTP.
- task: FtpUpload@2
  inputs:
    credentialsOption: 'serviceEndpoint' # 'serviceEndpoint' | 'inputs'. Alias: credsType. Required. Authentication Method. Default: serviceEndpoint.
    serverEndpoint: # string. Required when credsType = serviceEndpoint. FTP Service Connection. 
    #serverUrl: # string. Required when credsType = inputs. Server URL. 
    #username: # string. Required when credsType = inputs. Username. 
    #password: # string. Required when credsType = inputs. Password. 
    rootDirectory: # string. Alias: rootFolder. Required. Root folder. 
    filePatterns: '**' # string. Required. File patterns. Default: **.
    remoteDirectory: '/upload/$(Build.BuildId)/' # string. Alias: remotePath. Required. Remote directory. Default: /upload/$(Build.BuildId)/.
  # Advanced
    #clean: false # boolean. Delete remote directory. Default: false.
    #cleanContents: false # boolean. Optional. Use when clean = false. Clear remote directory contents. Default: false.
    #preservePaths: false # boolean. Preserve file paths. Default: false.
    #trustSSL: false # boolean. Trust server certificate. Default: false.

Inputs

credentialsOption - Authentication Method
Input alias: credsType. string. Required. Allowed values: serviceEndpoint (FTP service connection), inputs (Enter credentials). Default value: serviceEndpoint.

Specifies the authentication method. Use an FTP service connection or enter the connection credentials.


serverEndpoint - FTP Service Connection
string. Required when credsType = serviceEndpoint.

Specifies the service connection for the FTP server. To create one, click the Manage link and create a new generic service connection, and then enter the FTP server URL for the server URL, e.g. ftp://server.example.com, and the required credentials.

Secure connections will always be made regardless of the specified protocol (ftp:// or ftps://) if the target server supports FTPS. To allow only secure connections, use the ftps:// protocol, e.g. ftps://server.example.com. Connections to servers not supporting FTPS will fail if ftps:// is specified.


serverUrl - Server URL
string. Required when credsType = inputs.

Specifies the URL for the FTP server.


username - Username
string. Required when credsType = inputs.

Specifies the user name for the FTP connection.


password - Password
string. Required when credsType = inputs.

Specifies the password for the FTP connection.


implicitFTPS - Use implicit FTPS
boolean. Default value: false.


rootDirectory - Root folder
Input alias: rootFolder. string. Required.

Specifies the source folder to upload files from.


filePatterns - File patterns
string. Required. Default value: **.

Specifies the file paths or patterns of the files to upload. The string supports multiple lines of minimatch patterns. Learn more about file matching patterns.


remoteDirectory - Remote directory
Input alias: remotePath. string. Required. Default value: /upload/$(Build.BuildId)/.

Specifies the directory on the remote FTP server where the task uploads files.


enableUtf8 - Enable UTF8 support
boolean. Default value: false.

Enables UTF-8 support for the FTP connection (OPTS UTF8 ON).


clean - Delete remote directory
boolean. Default value: false.

Deletes the remote directory, including its contents, before uploading.


cleanContents - Clear remote directory contents
boolean. Optional. Use when clean = false. Default value: false.

Recursively deletes all content in the remote directory before uploading. The existing directory will not be deleted. For better performance, use clean instead.


preservePaths - Preserve file paths
boolean. Default value: false.

If selected, the relative local directory structure is recreated under the remote directory where files are uploaded. Otherwise, files are uploaded directly to the remote directory without creating additional subdirectories.

For example, suppose your source folder is /home/user/source/, which contains the file foo/bar/foobar.txt, and your remote directory is: /uploads/. If this boolean is selected, the file is uploaded to /uploads/foo/bar/foobar.txt. If this boolean is not selected, the file is uploaded to /uploads/foobar.txt.


trustSSL - Trust server certificate
boolean. Default value: false.

Trusts the FTP server's SSL certificate with ftps://, even if it is self-signed or cannot be validated by a certificate authority (CA).


customCmds - FTP Commands
string.

The optional FTP commands that will be sent to the remote FTP server upon connection.


Task control options

All tasks have control options in addition to their task inputs. For more information, see Control options and common task properties.

Output variables

None.

Remarks

Use this task to upload files to a remote machine using FTP or securely with FTPS.

Where can I learn more about file matching patterns?

Requirements

Requirement Description
Pipeline types YAML, Classic build, Classic release
Runs on Agent, DeploymentGroup
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command restrictions This task runs using the following command restrictions: restricted
Settable variables This task has permission to set the following variables: Setting variables is disabled
Agent version 2.182.1 or greater
Task category Utility
Requirement Description
Pipeline types YAML, Classic build, Classic release
Runs on Agent, DeploymentGroup
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command restrictions Any
Settable variables Any
Agent version All supported agent versions.
Task category Utility

See also