View comments | RSS feed
Contents > CFML Reference > ColdFusion Tags > cfftp action = "listDir" PreviousNext

cfftp action = "listDir"

To access the columns in a query object, use this tag with action = "listDir".

When you use this action, you must specify a value for the name attribute. This value holds the results of the listDir action in a query object. The query object consists of columns that you can reference, in the form queryname.columname[row], where queryname is the name of the query, specified in the name attribute; and columnname is a column returned in the query object. The value row is the row number of each file/directory entry returned by the listDir operation. A separate row is created for each entry:

cfftp query object column

Description

Name

Filename of the current element.

Path

File path (without drive designation) of the current element.

URL

Complete URL for the current element (file or directory).

Length

File size of the current element.

LastModified

Unformatted date/time value of the current element.

Attributes

String. Attributes of the current element: normal or Directory.

IsDirectory

Boolean. Whether object is a file or directory.

Mode

Applies only to UNIX and Linux. Permissions. Octal string.

Note: Previously supported query column values that pertain to system-specific information are not supported; for example, hidden and system.


Contents > CFML Reference > ColdFusion Tags > cfftp action = "listDir" PreviousNext

ColdFusion 9 | ColdFusion 8 | ColdFusion MX 7 | ColdFusion MX 6.1 | ColdFusion MX | Forums | Developer Center | Bug Reporting

Version 6.1

Comments are no longer accepted for ColdFusion MX 6.1. ColdFusion 8 is the current version.

Comments


lbryngel said on Feb 19, 2004 at 9:45 AM :
Not clear what the Attributes - attribute is for. It always seems to return an empty string.

We are working to improve the examples in the ColdFusion reference pages. We propose to replace the current example on this page with the the following example. If you have any comments on this example, add them to this page.

<p>Open a connection
<cfftp connection = "myConnection"
username = "support"
password = "paradise"
server = "ftp.mydomain.com"
action = "open"
stopOnError = "Yes">

<p>Did it succeed? <cfoutput>#cfftp.succeeded#</cfoutput>
<cfftp connection = "myConnection"
action = "LISTDIR"
stopOnError = "Yes"
name = "ListDirs"
directory = "/support/downloads">

<p>Choose the file to download by clicking on the URL link in table</p>
<table>
<tr>
<td><b>File Name</b></td>
<td><b>URL</b></td>
<td><b>Last Modified</b></td>
</tr>
<!--- Code only displays files for download and does not display any subdirectories --->
<cfloop query="ListDirs">
<cfif isdirectory is "no">
<cfoutput>
<tr>
<td>#name#</td>
<td><a href = "#url#">#url#</a></td>
<td>#DateFormat(lastmodified)#</td>
</tr>
</cfoutput>
</cfif>
</cfloop>
</table>

<cfdump var="#ListDirs#">

<p>Close the connection:
<cfftp connection = "myConnection"
action = "close"
stopOnError = "Yes">
<p>Did it succeed? <cfoutput>#cfftp.succeeded#</cfoutput>
MarkZet said on Mar 2, 2004 at 11:23 AM :
The LastModified time returned by CFFTP seem to be one month later than the actual last modified time on the server. Moreover, AM/PM times are switched!!
jrunrandy said on Mar 2, 2004 at 1:20 PM :
This is bug 51004 and should be fixed in the next release of ColdFusion.
OWIS said on Apr 6, 2004 at 1:13 PM :
Using CFFTP action="listdir", It would be helpful to have more technical info on what FTP commands this sends.
It would also be helpful to be able to pass a file mask so you can limit the results in your returned query.
For example, I am trying to get the file size and last modified date of a file on an FTP site that has 30,000 files in one directory.
I would like to pass an FTP equiv command such as DIR TEST.JPG
but I cannot seem to use action="listdir" to do this...I can only get the whole directory. If there is a way to pass this info like DIRECTORY="/TEST.JPG" that would be good to know...however my tests seem to indiciate you cannot do this.

Thank You.
Ryan Jones
halL said on Apr 20, 2004 at 8:34 AM :
You can do what OWIS has requested by specifying a filename filename pattern with wildcards in the directory attribute, as in directory="*.zip" or directory="/opt/*.html".

 

RSS feed | Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/coldfusion/6.1/htmldocs/tags-p42.htm