Skip to main content
April 14, 2011
Question

Loop over cfftp listdir output??

  • April 14, 2011
  • 1 reply
  • 598 views

I am trying to loop over the info in our FTP directory using:

<cfftp action="listdir" username="commmast" password="H57Jvc21" server="ftp2.idaho.gov" directory="commuser" name="DirList">

<cfdump var="#DirList#">

If I do a dump, I see all the files, and other info I want, but if I do a:

<cfloop query="#DirList#">

#name#

</cfloop>

I'm getting:

Complex object types cannot be converted to simple values.

Why would this be?

    This topic has been closed for replies.

    1 reply

    ilssac
    Inspiring
    April 14, 2011

    SteveG144 wrote:

    <cfloop query="#DirList#">

    ...

    Complex object types cannot be converted to simple values.

    Why would this be?

    Because you are NOT supposed to put # signs around the query name in the <cfloop...> tag.

    I.E. your code should be

    <cfloop query="DirList">


    In your code, ColdFusion is trying to resolve the variable "DirList" to derive a string to be used as the name of the query to loop over.  A record set (a complex data type) can not be made into a string (a simple data type).

    April 14, 2011

    Wow its been TOO LONG since I worked with CF............

    Thanks