1 ftp.cwd
<ftp.cwd dir='dir'/>
Attributes | |||||
---|---|---|---|---|---|
Name | Type | Required | Default | Description | |
Adir | String | Name of the folder which you want to access. |
Returns | |
---|---|
Type | Description |
Integer | Command response code (200 OK, 550 not found...see Reply codes). |
Exceptions
attribute 'dir' required
The new work directory has not been specified.
no active ftp connection
It is not possible to get the FTP communication with the server because there is not established.
List the content of the home directory, access to a subdirectory and list the content of this directory.
<xsql-script name='ftp_cwd_sample1'> <body> <ftp host='192.168.10.1' user='ftpuser' password='ftpdeister'> <println><ftp.list /></println> <ftp.cwd dir='clients' /> <println><ftp.list /></println> </ftp> </body> </xsql-script>
The execution of the script shows the right functioning of the directory change tag. First, it visualizes by the console the content of the home directory, access to the specified directory in the attribute ('clients') and finally, lists again the content of the new work directory.
List the content of the home directory, access to the subdirectory which do not exist and check the error code.
<xsql-script name='ftp_sample1'> <body> <ftp host='localhost' user='ftpuser' password='ftppassword'> <if> <expr><eq><ftp.cwd dir='MusicXX' /><number>550</number></eq></expr> <then> <println>EXCEPTION!!!</println> </then> <else> <println><ftp.list /></println> </else> </if> </ftp> </body> </xsql-script>
Returns the error code https://www.ietf.org/rfc/rfc959.txt