I'm trying to delete all the files in a directory, but not recursively and not including any subdirectories. The FB "FTP Delete File" command doesn't seem to accept wildcards, so I turned to the "FTP Send Command" action. I cannot get that to work.
Any command I send gets a 500 return code - unrecognized, including the following: "prompt off" "mdelete *.*. These are basic commands.
I've turned on ftp detailed logging, copied and pasted the actual commands that were actually sent to the remote site by the FB Send Command Action into the DOS ftp client at the command line, and voila! All works as expected.
So what am I doing wrong? I'm sure this is a stupid brain fart on my part, but I'm stumped.
The problem here is that neither "mdelete" nor "prompt off" are actual FTP protocol commands. The equivalent FTP protocol command is "DELE [filename]". Unfortunately, AFAIK there is no server-side equivalent of mdelete - the client app (even command line FTP) actually parses this and performs individual DELE commands.
If you're interested, here's a list of raw FTP commands, or you can go to the RFCs if you want in-depth information: http://www.nsftools.com/tips/RawFTP.htm
The FinalBuilder solution to this problem is a bit kludgey, but it can be done: use FTP List Directory to list the directory contents to a variable, then use a List Iterator to iterate each file and FTP Delete File to delete it. We have new, improved, FTP actions in development for a future release, but they won't be available in the immediate future.
I see. I never knew that some of the commands I took for granted were actually built in to the various ftp clients. I live with the workaround and look forward to the new actions.