I'm about to throw my monitor through the wall on this one. I'm working on a process to retrieve order files from an sFTP server, and I have to delete them off the server after downloading them. The CFFTP action="remove" call is returning a success status code, but the file is not actually being deleted from the server. I've tested this under both FTP and sFTP (the server supports both), and it's the same both ways. I also tested deleting the file through an FTP client (SecureFX), and that way it DOES actually delete the file, so I'm inclined to think it's not the server somehow blocking the action.
Here's my code:
<cfftp connection="ftpconn" server="#ftpserver#" username="#ftpuser#" password="#ftppw#" action="open" secure="true">
<cfftp connection="ftpconn" action="changedir" directory="#ftpfolder#">
<cfftp connection="ftpconn" action="listdir" directory="#ftpfolder#" name="orders">
<cfif Right(path,4) EQ ".asc">
<cfftp connection="ftpconn" action="getfile" remotefile="#path#" localfile="#inputdir##name#" failifexists="no">
<cfftp connection="ftpconn" action="getcurrentdir">
<cfftp connection="ftpconn" action="remove" item="#cfftp.returnvalue##name#">
<cfftp connection="ftpconn" action="listdir" directory="#ftpfolder#" name="noworders">
<cfftp connection="ftpconn" action="close">
The dumps of #orders# and #noworders# show me the directory listing before and after the delete, and they're constantly identical. The dump of the cfftp after the remove consistently shows me this:
|ErrorText||SSH_FX_OK successful completion of the operation|
|ReturnValue||0 SSH_FX_OK successful completion of the operation|
But the damn file is still there. I had originally NOT had the getcurrentdir call in there, just specifying the directory statically in the remove statement, but it was the same result.
I read the cfftp.succeeded as meaning that I'm specifying a valid file name, but for some reason it's not going away. I tried this under CF8 and CF10 to the same results.
Anybody seen this behavior before? I guess another option would be to try spawning a separate process to delete the files, but that really sucks.
Finally found the ridiculous solution--the delete command is case-sensitive, while the other commands are not. I had the path name incorrect ("/Outbox/orders" instead of "/Outbox/Orders"), and the listdir and getfile commands would work fine, but the remove command would not. How ridiculous.