Skip navigation
Currently Being Moderated

CF10 CFFTP listDir

May 16, 2013 3:25 PM

Can someone please help. I'm trying to do a simple list of directory and the command doesn't work.         

  <cfftp
     action="listdir"

     server="~~~~~.com"
     username="~~"<br>     password="~~~"
     name="test"
     directory="out"
     >

<cfdump var="#test#">  the command works fine in CF8 and CF9. But in CF10 it returns

h1. An error occurred during the FTP listdir operation.


Error: 215 . .

 

 
Replies
  • Currently Being Moderated
    May 17, 2013 12:11 AM   in reply to cf#stv#

    You first have to open the connection. After the listDir action, you have to close the connection. Follow the fully worked-out example in the ColdFusion livedocs on CFFTP with listDir action.

     
    |
    Mark as:
  • Currently Being Moderated
    May 17, 2013 8:01 AM   in reply to cf#stv#

    Does the folder that you're trying to list give READ permission to the FTP account that's trying to read it?

     

    Just throwin' stuff out there.

     

    ^_^

     
    |
    Mark as:
  • Currently Being Moderated
    May 17, 2013 8:18 AM   in reply to cf#stv#

    I would also throw the following in, as a long shot. FTP error 215 says something about system name. So, what about changing your name attribute from test  to, say, myTest ?

     
    |
    Mark as:
  • Currently Being Moderated
    May 17, 2013 8:40 AM   in reply to cf#stv#

    The "NAME" that the error 215 is referring to is the server name at the other end.  The "Name" in CFFTP is your query name.

    At this point I would run FileZilla with full tracing/logging turned on, and see if anything funky happens when you connect to the ftp server.  It will do a listdir automatically when it connects.  Look to see if the server changes its name or something like that.  The ftp support in CF10 is almost certainly different from that in CF8 or CF9, so maybe there is something that it is sensitive to.

     

    Wishing this advice wasn't so vague, but at this point it looks like you need more information about the connection that what CF is going to give you.  Keep us posted.

    reed

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 6, 2013 10:03 AM   in reply to Reed Powell

    Any word on this?  I'm having the same problem.  I can connect to a filezilla server and see that both coldfusion and ftp from a command prompt will translate the listdir and dir commands as a LIST action in filezilla.  I don't have access to the ftp server that's giving me this 215 error code unfortunately, maybe something interesting would be found in those logs.

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 31, 2013 9:15 AM   in reply to cf#stv#

    Adobe - you seem to have a problem here. I have tried ListDir on known connections and it fails every time. Can somebody provide an answer?

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 31, 2013 9:18 AM   in reply to mtnhomes

    Action="close" does not work either. It says "invalid Connection Specified" even if this command is issued immediately after the Open command which works fine.

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 8, 2014 11:09 AM   in reply to mtnhomes

    If you can access your ftp server via any ftp client like Filezilla then you will be able to list directories via ColdFusion as well. Share the stack trace as well.

     

    Sample Code

     

    <cfftp 

         port="21"

        action = "open"

        username = "username"

        connection = "ftp"

        password = "password"

        server = "abc.xyz.com"

        stopOnError = "Yes">

     

    <!--- Confirmation of Open --->   

       

    <cfoutput> Connection Open :#cfftp.succeeded# </cfoutput>

       

       

    <p>List the files in a directory:

     

    <cfftp

    action = "LISTDIR"

        stopOnError = "Yes"

        name = "ListFiles"

        directory = "/"

        connection = "ftp">

     

        <cfdump var="#ListFiles#">

       

    <cfftp

     

    action="close"

    connection="ftp"

    stopOnError = "Yes">

           

            <!--- Confirmation of Close --->   

           

    <cfoutput> Connection Closed :#cfftp.succeeded# </cfoutput>

     

    HTH

     

    Thanks

    VJ

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 8, 2014 11:26 AM   in reply to vishu#13

    Will do. However we installed CF 9 and it worked on first try. We had

    been trying for a week with CF10

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points