<html>
<head>
<link href="mmres://user_interface_reference.css" rel="stylesheet" type="text/css">
<title>CFFTP: CONNECTION: FILE AND DIRECTORY OPERATIONS</title>
</head>
<body bgcolor="#FFFFFF" text="#000000">
   <div id="Description">
   <table cellpadding="0" cellspacing="0" border="0" width="100%" class="main">
      <tr> 
         <td valign="top" class="name">CFFTP: CONNECTION: FILE AND DIRECTORY OPERATIONS</td>
         <td valign="top" nowrap class="compatibility">&nbsp;</td>
      </tr>
      <tr>
         <td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
      </tr>


    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">Description</span>
<p>
Use this form of the cfftp tag to perform file and directory operations with cfftp.
</p>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="syntax"><span class="title">Syntax</span><pre>&lt;cfftp 
   action = &quot;action&quot;
   username = &quot;name&quot;
   password = &quot;password&quot;
   name = &quot;query_name&quot;
   server = &quot;server&quot;
   ASCIIExtensionList = &quot;extensions&quot;
   transferMode = &quot;mode&quot;
   failIfExists = &quot;yes&quot; or &quot;no&quot;
   directory = &quot;directory name&quot;
   localFile = &quot;filename&quot;
   remoteFile = &quot;filename&quot;
   item = &quot;directory or file&quot;
   existing = &quot;file or directory name&quot;
   new = &quot;file or directory name&quot;
   proxyServer = &quot;proxy server&quot;
   passive = &quot;yes&quot; or &quot;no&quot;&gt;
result = &quot;result_name&quot;
</pre>    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">See also</span>
<p>
cfhttp, cfldap, cfmail, cfpop
</p>

<p>

</p>
    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">Usage</span>
<p>
If you use connection caching to an active FTP connection, you do not have to respecify the username, password, or server connection attributes.
</p>

<p>
Changing a cached connection, such as changing retryCount or timeout values, might require reestablishing the connection. 
</p>

<p>
If action = &quot;listDir&quot;, the attributes column returns directory or normal. Other platform-specific values, such as hidden and system, are no longer supported.
</p>

<p>
If action = &quot;listDir&quot;, a mode column is returned. The column contains an octal string representation of UNIX permissions; for example, &quot;777.&quot;
</p>

<p>
The cfftp.returnValue variable provides the return value for these actions:
</p>
<ul>

<li>getCurrentDir </li>

<li>getCurrentURL </li>

<li>existsDir </li>

<li>existsFile </li>

<li>exists</li>
</ul>

<p>
For more information, see ColdFusion MX Developer's Guide.
</p>
<table>
  <tr valign="top">
    <td width="30"><strong>Caution: </strong></td>
    <td>Object (file and directory) names are case-sensitive. </td>
  </tr>
</table>    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">Action (cfftp.ReturnValue variable)</span>
<p>
The results of an action determine the value of the returnValue variable, as the following table shows:
</p>

<p>
</p><div align="left">
<table border="1">
  <caption></caption>
  <tr align="center">    <th>&#160;</th>
    <th>&#160;</th>
</tr>
  <tr align="left">    <td>
<p>getCurrentDir</p></td>
    <td>
<p>String. Current directory.</p></td>
</tr>
  <tr align="left">    <td>
<p>getCurrentURL</p></td>
    <td>
<p>String. Current URL.</p></td>
</tr>
  <tr align="left">    <td>
<p>existsDir</p></td>
    <td>
<p>yes or no.</p></td>
</tr>
  <tr align="left">    <td>
<p>existsFile</p></td>
    <td>
<p>yes or no.</p></td>
</tr>
  <tr align="left">    <td>
<p>exists</p></td>
    <td>
<p>yes or no.</p></td>
</tr>
</table>
</div>
<p>
</p>

<p>
To access the returnValue variable, you must prefix it with either cfftp or the value specified by the result attribute, if it is set. The result attribute provides a way for cfftp calls from multiple pages, possibly at the same time, to avoid overwriting the results of one with another. If you set the result attribute to myResult, for example, you would access the returnVariable variable as myResult.returnVariable. Otherwise, you would access it as cfftp.returnVariable.
</p>
    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">Example</span>
<p>
The following example opens a connection and gets a file listing showing file or directory name, path, URL, length, and modification date: 
</p>
<pre>&lt;p&gt;Open a connection
&lt;cfftp connection = &quot;myConnection&quot; 
   username = &quot;myUserName&quot;
   password = &quot;myUserName@allaire.com&quot;
   server = &quot;ftp.allaire.com&quot;
   action = &quot;open&quot; 
   stopOnError = &quot;Yes&quot;&gt; 

&lt;p&gt;Did it succeed? &lt;cfoutput&gt;#cfftp.succeeded#&lt;/cfoutput&gt;
&lt;cfftp connection = &quot;myConnection&quot;
    action = &quot;LISTDIR&quot;
    stopOnError = &quot;Yes&quot;
    name = &quot;ListDirs&quot;
    directory = &quot;/&quot;&gt;

&lt;p&gt;FTP Directory Listing:&lt;br&gt; 
&lt;cftable query = &quot;ListDirs&quot; HTMLTable = &quot;Yes&quot; colHeaders = &quot;Yes&quot;&gt; 
   &lt;cfcol header = &quot;&lt;b&gt;Name&lt;/b&gt;&quot; text = &quot;#name#&quot;&gt;  
   &lt;cfcol header = &quot;&lt;b&gt;Path&lt;/b&gt;&quot; text = &quot;#path#&quot;&gt; 
   &lt;cfcol header = &quot;&lt;b&gt;URL&lt;/b&gt;&quot; text = &quot;#url#&quot;&gt; 
   &lt;cfcol header = &quot;&lt;b&gt;Length&lt;/b&gt;&quot; text = &quot;#length#&quot;&gt; 
   &lt;cfcol header = &quot;&lt;b&gt;LastModified&lt;/b&gt;&quot; 
    text = &quot;#DateFormat(lastmodified)#&quot;&gt;  
   &lt;cfcol header = &quot;&lt;b&gt;IsDirectory&lt;/b&gt;&quot; text = &quot;#isdirectory#&quot;&gt; 
&lt;/cftable&gt;

&lt;p&gt;Move Image File to Remote Server:&lt;br&gt;&lt;/p&gt;
&lt;!--- The image will be put into the root directory of the FTP server unless 
otherwise noted. 
i.e. remoteFile = &quot;somewhere_put.jpg&quot; vs remoteFile = &quot;/support/
somewhere_put.jpg&quot;
---&gt; 
&lt;cfftp 
connection = &quot;myConnection&quot;
action = &quot;putFile&quot; 
name = &quot;uploadFile&quot; 
transferMode = &quot;binary&quot; 
localFile = &quot;C:\files\upload\somewhere.jpg&quot; 
remoteFile = &quot;somewhere_put.jpg&quot; 
&gt;
&lt;p&gt;Did it succeed? &lt;cfoutput&gt;#cfftp.succeeded#&lt;/cfoutput&gt; 

&lt;p&gt;Close the connection:
&lt;cfftp connection = &quot;myConnection&quot;
    action = &quot;close&quot;
    stopOnError = &quot;Yes&quot;&gt;
&lt;p&gt;Did it succeed? &lt;cfoutput&gt;#cfftp.succeeded#&lt;/cfoutput&gt;
</pre>
         </td>
      </tr>
   </table>
   </div>
<div id="ACTION">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">ACTION</td>
  <td valign="top" nowrap class="compatibility">&nbsp;</td>
  </tr>
  <tr>
  <td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
  </tr>

  <tr>
  <td valign="top" class="syntax">&nbsp;</td>
  <td valign="top" nowrap class="requirements">Required if connection is not cached</td>
  </tr>
  <tr>
  <td colspan="2" class="clearseparation">&nbsp;</td>
  </tr>
  <tr>
  <td valign="top" colspan="2" class="description">



<p>FTP operation to perform:</p><ul>

<li>changedir </li>

<li>createDir </li>

<li>listDir </li>

<li>removeDir</li>

<li>getFile </li>

<li>putFile </li>

<li>rename </li>

<li>remove</li>

<li>getCurrentDir </li>

<li>getCurrentURL </li>

<li>existsDir </li>

<li>existsFile </li>

<li>exists</li>
</ul>


  </td>
  </tr>
  </table>
</div>
<div id="USERNAME">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">USERNAME</td>
  <td valign="top" nowrap class="compatibility">&nbsp;</td>
  </tr>
  <tr>
  <td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
  </tr>

  <tr>
  <td valign="top" class="syntax">&nbsp;</td>
  <td valign="top" nowrap class="requirements">Required if connection is not cached</td>
  </tr>
  <tr>
  <td colspan="2" class="clearseparation">&nbsp;</td>
  </tr>
  <tr>
  <td valign="top" colspan="2" class="description">



<p>User name to pass in the FTP operation.</p>

  </td>
  </tr>
  </table>
</div>
<div id="PASSWORD">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">PASSWORD</td>
  <td valign="top" nowrap class="compatibility">&nbsp;</td>
  </tr>
  <tr>
  <td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
  </tr>

  <tr>
  <td valign="top" class="syntax">&nbsp;</td>
  <td valign="top" nowrap class="requirements">Required if action = &quot;open&quot;</td>
  </tr>
  <tr>
  <td colspan="2" class="clearseparation">&nbsp;</td>
  </tr>
  <tr>
  <td valign="top" colspan="2" class="description">



<p>Password to log in the user.</p>

  </td>
  </tr>
  </table>
</div>
<div id="NAME">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">NAME</td>
  <td valign="top" nowrap class="compatibility">&nbsp;</td>
  </tr>
  <tr>
  <td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
  </tr>

  <tr>
  <td valign="top" class="syntax">&nbsp;</td>
  <td valign="top" nowrap class="requirements">Required if action = &quot;listDir&quot;</td>
  </tr>
  <tr>
  <td colspan="2" class="clearseparation">&nbsp;</td>
  </tr>
  <tr>
  <td valign="top" colspan="2" class="description">



<p>Query name of directory listing. </p>

  </td>
  </tr>
  </table>
</div>
<div id="SERVER">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">SERVER</td>
  <td valign="top" nowrap class="compatibility">&nbsp;</td>
  </tr>
  <tr>
  <td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
  </tr>

  <tr>
  <td valign="top" class="syntax">&nbsp;</td>
  <td valign="top" nowrap class="requirements">Required if FTP connection is not cached</td>
  </tr>
  <tr>
  <td colspan="2" class="clearseparation">&nbsp;</td>
  </tr>
  <tr>
  <td valign="top" colspan="2" class="description">



<p>FTP server to which to connect; for example, ftp.myserver.com.</p>

  </td>
  </tr>
  </table>
</div>
<div id="ASCIIEXTENSIONLIST">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">ASCIIEXTENSIONLIST</td>
  <td valign="top" nowrap class="compatibility">&nbsp;</td>
  </tr>
  <tr>
  <td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
  </tr>

  <tr>
  <td valign="top" class="syntax">&nbsp;</td>
  <td valign="top" nowrap class="requirements">Optional</td>
  </tr>
  <tr>
  <td colspan="2" class="clearseparation">&nbsp;</td>
  </tr>
  <tr>
  <td valign="top" colspan="2" class="description">

<strong>Default value:</strong> "txt;htm;html;cfm;cfml;shtm;shtml;css;asp;asa"


<p>Delimited list of file extensions that force ASCII transfer mode, if transferMode = &quot;auto&quot;. </p>

  </td>
  </tr>
  </table>
</div>
<div id="TRANSFERMODE">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">TRANSFERMODE</td>
  <td valign="top" nowrap class="compatibility">&nbsp;</td>
  </tr>
  <tr>
  <td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
  </tr>

  <tr>
  <td valign="top" class="syntax">&nbsp;</td>
  <td valign="top" nowrap class="requirements">Optional</td>
  </tr>
  <tr>
  <td colspan="2" class="clearseparation">&nbsp;</td>
  </tr>
  <tr>
  <td valign="top" colspan="2" class="description">

<strong>Default value:</strong> "Auto"

<ul>

<li>ASCII FTP transfer mode</li>

<li>Binary FTP transfer mode</li>

<li>Auto FTP transfer mode</li>
</ul>


  </td>
  </tr>
  </table>
</div>
<div id="FAILIFEXISTS">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">FAILIFEXISTS</td>
  <td valign="top" nowrap class="compatibility">&nbsp;</td>
  </tr>
  <tr>
  <td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
  </tr>

  <tr>
  <td valign="top" class="syntax">&nbsp;</td>
  <td valign="top" nowrap class="requirements">Optional</td>
  </tr>
  <tr>
  <td colspan="2" class="clearseparation">&nbsp;</td>
  </tr>
  <tr>
  <td valign="top" colspan="2" class="description">

<strong>Default value:</strong> "yes"

<ul>

<li>yes: if a local file with same name exists, the getFile action will fail.</li>

<li>no</li>
</ul>


  </td>
  </tr>
  </table>
</div>
<div id="DIRECTORY">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">DIRECTORY</td>
  <td valign="top" nowrap class="compatibility">&nbsp;</td>
  </tr>
  <tr>
  <td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
  </tr>

  <tr>
  <td valign="top" class="syntax">&nbsp;</td>
  <td valign="top" nowrap class="requirements">Required if action = &quot;changedir&quot;, &quot;createDir&quot;, &quot;listDir&quot;, or &quot;existsDir&quot;</td>
  </tr>
  <tr>
  <td colspan="2" class="clearseparation">&nbsp;</td>
  </tr>
  <tr>
  <td valign="top" colspan="2" class="description">



<p>Directory on which to perform an operation.</p>

  </td>
  </tr>
  </table>
</div>
<div id="LOCALFILE">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">LOCALFILE</td>
  <td valign="top" nowrap class="compatibility">&nbsp;</td>
  </tr>
  <tr>
  <td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
  </tr>

  <tr>
  <td valign="top" class="syntax">&nbsp;</td>
  <td valign="top" nowrap class="requirements">Required if action = &quot;getFile&quot; or &quot;putFile&quot;</td>
  </tr>
  <tr>
  <td colspan="2" class="clearseparation">&nbsp;</td>
  </tr>
  <tr>
  <td valign="top" colspan="2" class="description">



<p>Name of the file on the local file system.</p>

  </td>
  </tr>
  </table>
</div>
<div id="REMOTEFILE">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">REMOTEFILE</td>
  <td valign="top" nowrap class="compatibility">&nbsp;</td>
  </tr>
  <tr>
  <td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
  </tr>

  <tr>
  <td valign="top" class="syntax">&nbsp;</td>
  <td valign="top" nowrap class="requirements">Required if action = &quot;getFile&quot;, &quot;putFile&quot;, or &quot;existsFile&quot;</td>
  </tr>
  <tr>
  <td colspan="2" class="clearseparation">&nbsp;</td>
  </tr>
  <tr>
  <td valign="top" colspan="2" class="description">



<p>Name of the file on the FTP server file system.</p>

  </td>
  </tr>
  </table>
</div>
<div id="ITEM">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">ITEM</td>
  <td valign="top" nowrap class="compatibility">&nbsp;</td>
  </tr>
  <tr>
  <td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
  </tr>

  <tr>
  <td valign="top" class="syntax">&nbsp;</td>
  <td valign="top" nowrap class="requirements">Required if action = &quot;exists&quot; or &quot;remove&quot;</td>
  </tr>
  <tr>
  <td colspan="2" class="clearseparation">&nbsp;</td>
  </tr>
  <tr>
  <td valign="top" colspan="2" class="description">



<p>Object of these actions: file or directory.</p>

  </td>
  </tr>
  </table>
</div>
<div id="EXISTING">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">EXISTING</td>
  <td valign="top" nowrap class="compatibility">&nbsp;</td>
  </tr>
  <tr>
  <td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
  </tr>

  <tr>
  <td valign="top" class="syntax">&nbsp;</td>
  <td valign="top" nowrap class="requirements">Required if action = &quot;rename&quot;</td>
  </tr>
  <tr>
  <td colspan="2" class="clearseparation">&nbsp;</td>
  </tr>
  <tr>
  <td valign="top" colspan="2" class="description">



<p>Current name of the file or directory on the remote server.</p>

  </td>
  </tr>
  </table>
</div>
<div id="NEW">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">NEW</td>
  <td valign="top" nowrap class="compatibility">&nbsp;</td>
  </tr>
  <tr>
  <td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
  </tr>

  <tr>
  <td valign="top" class="syntax">&nbsp;</td>
  <td valign="top" nowrap class="requirements">Required if action = &quot;rename&quot;</td>
  </tr>
  <tr>
  <td colspan="2" class="clearseparation">&nbsp;</td>
  </tr>
  <tr>
  <td valign="top" colspan="2" class="description">



<p>New name of file or directory on the remote server.</p>

  </td>
  </tr>
  </table>
</div>
<div id="PROXYSERVER">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">PROXYSERVER</td>
  <td valign="top" nowrap class="compatibility">&nbsp;</td>
  </tr>
  <tr>
  <td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
  </tr>

  <tr>
  <td valign="top" class="syntax">&nbsp;</td>
  <td valign="top" nowrap class="requirements">Optional</td>
  </tr>
  <tr>
  <td colspan="2" class="clearseparation">&nbsp;</td>
  </tr>
  <tr>
  <td valign="top" colspan="2" class="description">



<p>String. Name of the proxy server (s) to use, if proxy access is specified.</p>

  </td>
  </tr>
  </table>
</div>
<div id="PASSIVE">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">PASSIVE</td>
  <td valign="top" nowrap class="compatibility">&nbsp;</td>
  </tr>
  <tr>
  <td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
  </tr>

  <tr>
  <td valign="top" class="syntax">&nbsp;</td>
  <td valign="top" nowrap class="requirements">Optional</td>
  </tr>
  <tr>
  <td colspan="2" class="clearseparation">&nbsp;</td>
  </tr>
  <tr>
  <td valign="top" colspan="2" class="description">

<strong>Default value:</strong> "no"

<ul>

<li>yes: enables passive mode.</li>

<li>no</li>
</ul>


  </td>
  </tr>
  </table>
</div>
<div id="RESULT">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">RESULT</td>
  <td valign="top" nowrap class="compatibility">&nbsp;</td>
  </tr>
  <tr>
  <td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
  </tr>

  <tr>
  <td valign="top" class="syntax">&nbsp;</td>
  <td valign="top" nowrap class="requirements">Optional</td>
  </tr>
  <tr>
  <td colspan="2" class="clearseparation">&nbsp;</td>
  </tr>
  <tr>
  <td valign="top" colspan="2" class="description">



<p>Specifies a name for the structure in which cfftp stores the returnValue variable. If set, this value replaces cfftp as the prefix to use when accessing returnVariable. See the Usage section for more information</p>

  </td>
  </tr>
  </table>
</div>

  </body>
</html>
