title: Apache Commons Net FTPClient - PUT instead of STOR?
body: <p>I am using the Apache commons net FTPClient to distribute files as part of batch jobs. The client is encapsulated, but roughly I issue the following method calls (i have omitted error handling, stream handling etc. for brevity):</p>
  
  <pre><code>FTPClient client = new FTPClient();
  client.connect("127.0.0.1", 22);
  client.login("user", "password");
  client.setFileType(FTP.BINARY_FILE_TYPE);
  client.changeWorkingDirectory("path/");
  client.storeFile("file1.txt", new ByteArrayInputStream("hello world".getBytes()));
  client.disconnect();
  </code></pre>
  
  <p>When I issue the commands above, The following commands are sent to the FTP server:</p>
  
  <pre><code>USER zoor
  PASS ********
  TYPE I
  CWD path/
  PORT 127,0,0,1,229,72
  STOR file1.txt
  </code></pre>
  
  <p>And this works fine. Now, however, I am in a situation where i need to send files to a legacy system which does not support <code>CWD</code> or <code>STOR</code> but instead relies on <code>CD</code> and <code>PUT</code>, respectively..</p>
  
  <p>Now my question is, how do I make the FTPClient use these commands? </p>
  
  <p>I could use the <code>sendCommand</code> method to send the <code>CD</code> command, but I am not sure how to do this properly (and correctly) with the PUT command (given that I must send the file data also).</p>
  
  <p>NOTE: I realize that there are better ways than FTP to distribute files like this, but unfortunately, my hands are bound. The recipients are using FTP and are not willing to change.</p>
  
  <p><strong>UPDATE:</strong> The legacy system is an AS/400 machine. </p>