Using Before/After PUT-GET commands in BizTalk 2004 FTP adapter

BizTalk 2004 FTP adapter allows administrators to specify Before/After PUT (or GET) commands. This is usually helpful to change the default directory after the initial FTP login.

 

Some folks have tried FTP commands like cd dirname without success. It fails with “unknown command“. The reason for this is that cd is an FTP client command and not a raw FTP command (i.e. FTP protocol command). Most (if not all) FTP client provide a command translation interface to make the FTP protocol “look” similar to regular shell commands. For instance, under UN*X, cd is translated to CWD and ls is translated to LIST.

 

You have to use FTP protocol commands. Here is a non exhaustive list of the command you can use with the FTP adapter in BizTalk 2004 (I pulled it from the RFC at https://www.faqs.org/rfcs/rfc959.html). The striked lines are commands that you do nto want to use (see below).

 

APPE – append to a remote file
CDUP – CWD to the parent of the current directory
CWD – change working directory
DELE – delete a remote file
LIST – list remote files
MDTM – return the modification time of a file
MKD – make a remote directory
MODE – set the transfer mode
PASS – send password
PASV – enter passive mode
PORT – open a data port
PWD – print working directory
QUIT – terminate the connection
RETR – retrieve a remote file
RMD – remove a remote directory
RNFR – rename from
RNTO – rename to
SITE – site-specific commands
SIZE – return the size of a file
STOR – store a file on the remote host
TYPE – set the transfer type
USER – send username

Update [July 6th, 2004] : I introduced by mistakes commands that cannot be executed as part of a "Pre“ and/or “Post" FTP command. For instance, consider QUIT. This command, when executed as a “Pre“ command will shut down the session, making it impossible for the adapter to actually get or put a file. Moreover, STOR, cannot be used because it requires an actual file to be transfered. This is the job of the “PUT” operation in BizTalk. So intead of using STOR in a Pre/Post command, you should use the FTP adapter's main feature which is to tore or get files.