Change of working directory to the specified directory.

1 ftp.cwd

<ftp.cwd dir='dir'/>

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.

Example

List the content of the home directory, access to a subdirectory and list the content of this directory.

Copy
<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.

Example

List the content of the home directory, access to the subdirectory which do not exist and check the error code.

Copy
<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