I am using existsDir
to check if a folder exists or not.
<cfftp action="existsDir"
connection="FTP"
directory="/Download/Test">
#cfftp.returnvalue#
If the folder exists, then everything works fine. The returnvalue
is "yes". If the folder doesn't exist, then the existsDir
action fails with the following error:
An error occurred during the sFTP existsDir operation. The system cannot find the path /Download/Test
The whole point of this action is to determine whether a folder exists. Yet it is causing an error if it doesn't exist. Am I missing something?
I can add try and catch around this whole statement (i am going add it anyway just to be safe), but that would make this existDir pointless.
I experienced this also. Seems to be a bug alright even in CF 2016 (which we just migrated to). I got around it by setting stoponerror="No" during the cfftp action="existsDir" usage like this;
<cfftp action="existsDir"
connection="ftp_connection"
directory="#remote_path#"
stoponerror="No">
You can then just check if it 'succeeded' and create the Dir if necessary;
<cfif cfftp.succeeded NEQ "YES">
<!--- Create directory --->
<cfftp action="createDir"
connection="ftp_connection"
directory="#remote_path#"
stoponerror="No">
</cfif>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With