RPA.FTP
Abort a file transfer in progress
return: | true or false based on success or failure |
---|
Close connection to the server unilaterally
Connect to FTP server
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
host | str | null | address of the server |
port | int | 21 | port of the server, defaults to 21 |
user | str, None | None | login name, defaults to None |
password | str, None | None | login password, defaults to None |
tls | bool | False | connect using TLS support, defaults to False |
transfer | str | passive | mode of the transfer, defaults to "passive" |
keyfile | str, None | None | path to private key file |
certfile | str, None | None | path to certificate file |
timeout | int, None | None | a timeout in seconds for the connection attempt |
source_address | Tuple[str, int], None | None | socket to bind to as its source address before connecting |
param host: | address of the server |
---|---|
param port: | port of the server, defaults to 21 |
param user: | login name, defaults to None |
param password: | login password, defaults to None |
param tls: | connect using TLS support, defaults to False |
param transfer: | mode of the transfer, defaults to "passive" |
param keyfile: | path to private key file |
param certfile: | path to certificate file |
param timeout: | a timeout in seconds for the connection attempt |
param source_address: | |
socket to bind to as its source address before connecting | |
raises AuthenticationException: | |
on authentication error with the server | |
return: | true if the connnection completes and an error code if it fails |
Change working directory on the server
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
dirname | str | null | name of the directory |
param dirname: | name of the directory |
---|---|
return: | true or false based on success or failure |
Delete file on the server
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
filepath | str | null | path to server file |
param filepath: | path to server file |
---|---|
return: | true or false based on success or failure |
Download file from FTP server
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
remotefile | str | null | path to remote file on the server |
localfile | str, None | None | name of the downloaded file on the local filesystem, if None will have same name as remote file |
param remotefile: | |
---|---|
path to remote file on the server | |
param localfile: | |
name of the downloaded file on the local filesystem, if None will have same name as remote file | |
return: | true or false based on success or failure |
Return byte size of the file on the server
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
filepath | str | null | path to server file |
param filepath: | path to server file |
---|---|
return: | byte size as an int |
Get server welcome message
return: | welcome message as a string |
---|
List files on the server directory
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
dirname | str | name of the directory |
param dirname: | name of the directory |
---|---|
return: | list of files present in the server directory |
Create a new directory on the server
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
dirname | str | null | name of the directory |
param dirname: | name of the directory |
---|---|
return: | true or false based on success or failure |
Get current working directory on the server
return: | current working directory name as a string |
---|
Send QUIT command to the server and close connection
Rename file on the server
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
fromname | str | null | current name of the file |
toname | str | null | new name for the file |
param fromname: | current name of the file |
---|---|
param toname: | new name for the file |
return: | true or false based on success or failure |
Remove directory on the server
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
dirname | str | null | name of the directory |
param dirname: | name of the directory |
---|---|
return: | true or false based on success or failure |
Execute command on the server
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
command | str | null | name of the command to send |
List of FTP commands: https://en.wikipedia.org/wiki/List_of_FTP_commands
param command: | name of the command to send |
---|---|
return: | true or false based on success or failure |
Set transfer mode to ASCII
return: | true or false based on success or failure |
---|
Set transfer mode to BINARY
return: | true or false based on success or failure |
---|
Set debug level for the library
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
level | int | 0 | integer value of debug level, defaults to 0 |
param level: | integer value of debug level, defaults to 0 |
---|---|
return: | true or false based on success or failure |
0 - no debugging output 1 - moderate amount of debugging 2+ - higher amount of debugging
Upload file to FTP server
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
localfile | str | null | path to file to upload |
remotefile | str | null | name of uploaded file in the server |
param localfile: | |
---|---|
path to file to upload | |
param remotefile: | |
name of uploaded file in the server | |
return: | true or false based on success or failure |