cd(path
:
String)
:
boolean
Changes the current directory on the remote server to the given path.
connect(host
:
String)
:
boolean
Connects and logs on to an FTP Server as "anonymous" and returns a boolean indicating success or failure.
connect(host
:
String, user
:
String, password
:
String)
:
boolean
Connects and logs on to an FTP server and returns a boolean indicating success or failure.
connect(host
:
String, port
:
Number)
:
boolean
Connects and logs on to an FTP Server as "anonymous" and returns a boolean indicating success or failure.
connect(host
:
String, port
:
Number, user
:
String, password
:
String)
:
boolean
Connects and logs on to an FTP server and returns a boolean indicating success or failure.
del(path
:
String)
:
boolean
Deletes the remote file on the server identified by the path parameter.
disconnect()
:
void
The method first logs the current user out from the server and then disconnects from the server.
get(path
:
String)
:
String
Reads the content of a remote file and returns it as a string using "ISO-8859-1" encoding to read it.
get(path
:
String, encoding
:
String)
:
String
Reads the content of a remote file and returns it as string using the passed encoding.
get(path
:
String, maxGetSize
:
Number)
:
String
Reads the content of a remote file and returns it as a string using "ISO-8859-1" encoding to read it.
get(path
:
String, encoding
:
String, maxGetSize
:
Number)
:
String
Reads the content of a remote file and returns it as a string using the specified encoding.
get(path
:
String, encoding
:
String, file
:
File)
:
boolean
Reads the content of a remote file and creates a local copy in the given file using the passed string encoding to read the file content and using the system standard encoding "UTF-8" to write the file.
get(path
:
String, encoding
:
String, file
:
File, maxGetSize
:
Number)
:
boolean
Reads the content of a remote file and creates a local copy in the given file using the passed string encoding to read the file content and using the system standard encoding "UTF-8" to write the file.
getBinary(path
:
String, file
:
File)
:
boolean
Reads the content of a remote file and creates a local copy in the given file.
getBinary(path
:
String, file
:
File, maxGetSize
:
Number)
:
boolean
Reads the content of a remote file and creates a local copy in the given file.
getConnected()
:
boolean
Identifies if the FTP client is currently connected to the FTP server.
list()
:
FTPFileInfo[]
Returns a list of FTPFileInfo objects containing information about the files in the current directory.
list(path
:
String)
:
FTPFileInfo[]
Returns a list of FTPFileInfo objects containing information about the files in the remote directory defined by the given path.
put(path
:
String, content
:
String)
:
boolean
Puts the specified content to the specified full path using "ISO-8859-1" encoding.
put(path
:
String, content
:
String, encoding
:
String)
:
boolean
Put the given content to a file on the given full path on the FTP server.
putBinary(path
:
String, file
:
File)
:
boolean
Put the content of the given file into a file on the remote FTP server with the given full path.
removeDirectory(path
:
String)
:
boolean
Deletes the remote directory on the server identified by the path parameter.
setTimeout(timeoutMillis
:
Number)
:
void
Sets the timeout for connections made with the FTP client to the given number of milliseconds.
cd
Changes the current directory on the remote server to the given path.
Parameters:
path
-
the new current directory
Returns:
true if the directory change was okay
connect
connect(host
:
String)
:
boolean
Connects and logs on to an FTP Server as "anonymous" and returns a boolean indicating success or failure.
Parameters:
host
-
Name of the FTP sever
Returns:
true when connection is successful, false otherwise.
connect
Connects and logs on to an FTP server and returns a boolean indicating success or failure.
Parameters:
host
-
Name of the FTP sever
user
-
User name for the login
password
-
Password for the login
Returns:
true when connection is successful, false otherwise.
connect
Connects and logs on to an FTP Server as "anonymous" and returns a boolean indicating success or failure.
Parameters:
host
-
Name of the FTP sever
port
-
Port for FTP server
Returns:
true when connection is successful, false otherwise.
connect
Connects and logs on to an FTP server and returns a boolean indicating success or failure.
Parameters:
host
-
Name of the FTP sever
port
-
Port for FTP server
user
-
User name for the login
password
-
Password for the login
Returns:
true when connection is successful, false otherwise.
del
Deletes the remote file on the server identified by the path parameter.
Parameters:
path
-
the path to the file.
Returns:
true if the file was successfully deleted, false otherwise.
disconnect
disconnect()
:
void
The method first logs the current user out from the server and then disconnects from the server.
get
Reads the content of a remote file and returns it as a string using "ISO-8859-1" encoding to read it. Read at
most MAX_GET_STRING_SIZE bytes.
Parameters:
path
-
remote path of the file to be read.
Returns:
the contents of the file or null if an error occured while reading the file.
get
Reads the content of a remote file and returns it as string using the passed encoding. Read at most
MAX_GET_STRING_SIZE characters.
Parameters:
path
-
remote path of the file to be read.
encoding
-
an ISO 8859 character encoding labeled as a string, e.g. "ISO-8859-1"
Returns:
the contents of the file or null if an error occurred while reading the file.
get
Reads the content of a remote file and returns it as a string using "ISO-8859-1" encoding to read it. Read at
most maxGetSize characters.
Deprecated:
The maxGetSize attribute is not supported anymore. Use the method get(String) instead.
Parameters:
path
-
remote path of the file to be read.
maxGetSize
-
the maximum bytes fetched from the remote file.
Returns:
the contents of the file or null if an error occurred while reading the file.
get
Reads the content of a remote file and returns it as a string using the specified encoding. Returns at most
maxGetSize characters.
Parameters:
path
-
remote path of the file to be read.
encoding
-
the encoding to use.
maxGetSize
-
the maximum bytes fetched from the remote file.
Returns:
the contents of the file or null if an error occurred while reading the file.
get
Reads the content of a remote file and creates a local copy in the given file using the passed string encoding to
read the file content and using the system standard encoding "UTF-8" to write the file. Copies at most
MAX_GET_FILE_SIZE bytes.
Parameters:
path
-
remote path of the file to be read.
encoding
-
the encoding to use.
file
-
the local file name
Returns:
true if remote file is fetched and copied into local file.
get
Reads the content of a remote file and creates a local copy in the given file using the passed string encoding to
read the file content and using the system standard encoding "UTF-8" to write the file. Copies at most maxGetSize
bytes.
Parameters:
path
-
remote path of the file to be read.
encoding
-
the encoding to use.
file
-
the local file name
maxGetSize
-
the maximum number of bytes to fetch
Returns:
true if remote file is fetched and copied into local file.
getBinary
Reads the content of a remote file and creates a local copy in the given file. Copies at most MAX_GET_FILE_SIZE
bytes. The FTP transfer is done in Binary mode.
Parameters:
path
-
remote path of the file to be read.
file
-
the local file name
Returns:
true if remote file is fetched and copied into local file.
getBinary
Reads the content of a remote file and creates a local copy in the given file. Copies at most maxGetSize bytes.
The FTP transfer is done in Binary mode.
Parameters:
path
-
remote path of the file to be read.
file
-
the local file name
maxGetSize
-
the maximum number of bytes to fetch
Returns:
true if remote file is fetched and copied into local file.
getConnected
getConnected()
:
boolean
Identifies if the FTP client is currently connected to the FTP server.
Returns:
true if the client is currently connected.
getReplyCode
Returns the reply code from the last FTP action.
Returns:
the reply code from the last FTP action.
getReplyMessage
Returns the string message from the last FTP action.
Returns:
the string message from the last FTP action.
getTimeout
Returns the timeout for this client, in milliseconds.
Returns:
the timeout in milliseconds
list
Returns a list of FTPFileInfo objects containing information about the files in the current directory.
Returns:
list of objects with remote file information.
list
Returns a list of FTPFileInfo objects containing information about the files in the remote directory defined by
the given path.
Parameters:
path
-
the remote path from which the file info is listed.
Returns:
list of objects with remote file information.
mkdir
mkdir(path
:
String)
:
boolean
Creates a directory
Parameters:
path
-
the path to the directory to create.
Returns:
true if the directory was successfully created, false otherwise.
put
Puts the specified content to the specified full path using "ISO-8859-1" encoding. The full path must include the
path and the file name. If the content of a local file is to be uploaded, please use method
putBinary(String, File) instead.
Parameters:
path
-
full path on the remote FTP server where the file will be stored.
content
-
the content to put.
Returns:
true or false indicating success or failure.
put
Put the given content to a file on the given full path on the FTP server. The full path must include the path and
the file name. The transformation from String into binary data is done via the encoding provided with the method
call. If the content of a local file is to be uploaded, please use method
putBinary(String, File)
instead.
Parameters:
path
-
the full path on the remote FTP server where the file will be stored.
content
-
the content to put.
encoding
-
the encoding to use.
Returns:
true or false indicating success or failure.
putBinary
Put the content of the given file into a file on the remote FTP server with the given full path. The full path
must include the path and the file name.
Parameters:
path
-
the full path on the remote FTP server where the file will be stored.
file
-
the file on the local system, which content is send to the remote FTP server.
Returns:
true or false indicating success or failure.
removeDirectory
removeDirectory(path
:
String)
:
boolean
Deletes the remote directory on the server identified by the path parameter. In order to delete the directory
successfully the directory needs to be empty, otherwise the removeDirectory() method will return false.
Parameters:
path
-
the path to the directory.
Returns:
true if the directory was successfully deleted, false otherwise.
rename
Renames an existing file.
Parameters:
from
-
the file that will be renamed.
to
-
the name of the new file.
Returns:
true if the file was successfully renamed, false otherwise.
setTimeout
setTimeout(timeoutMillis
:
Number)
:
void
Sets the timeout for connections made with the FTP client to the given number of milliseconds. If the given
timeout is less than or equal to zero, the timeout is set to the same value as the script context timeout but
will only be set to a maximum of 30 seconds.
The maximum and default timeout depend on the script context timeout. The maximum timeout is set to a maximum of
2 minutes. The default timeout for a new client is set to a maximum of 30 seconds.
This method can be called at any time, and will affect the next connection made with this client. It is not
possible to set the timeout for an open connection.
Parameters:
timeoutMillis
-
timeout, in milliseconds, up to a maximum of 2 minutes.