CFFTP action EXISTSDIR bug

January 9, 2010 · No Comments

<cfftp action="EXISTSDIR" connection="myConnection"
        directory="/home/andy.allan/new_folder" 
        port="22" fingerprint="goes_here" secure="true">

The above Code throws the following error should the directory not exist:

An error occured during the sFTP EXISTSDIR operation.

According to the documentation, any code with the attribute action="EXISTSDIR" should provide a return value accessible via cfftp.returnValue and this value should be true or false.

The way around this is to use some error handling and to catch the exception by doing the following:

<cfftp action="EXISTSDIR" connection="myConnection"
        directory="/home/andy.alla/new_folder/" 
        port="22" fingerprint="goes_here" secure="true">
       
       
        <cfcatch type="any">
            <cfif cfcatch.action IS "EXISTSDIR" AND cfcatch.Message IS "An error occurred during the sFTP EXISTSDIR operation.">
                <cfftp action="CREATEDIR" connection="myConnection"  
        directory="/home/andy.allan/new_folder"  port="22" fingerprint="goes_here" secure="true">
            <cfelse>
            <cfdump var="#cfcatch#" />
            <cfabort>
            </cfif>
        </cfcatch>
</cftry>

Tags: ColdFusion

0 response s so far ↓

  • There are no comments yet...Kick things off by filling out the form below.

Leave a Comment

Leave this field empty: