Author : Chirag Mehta & Angelica Buffa

Using FTP servers to store and share files is very common now at days. Most language programs let you develop FTP clients and consume their services.

With Apex, there are three possible approaches to resolve the integration with this kind of file servers:

I – Data Loader CLI – Windows approach.

  1. Download Salesforce Data Loader Command Line Interface (Read more at
  2. Write a Widows Batch file (.bat file)
  3. First command in the batch file will be connect to FTP server (ms-dos command ‘ftp’) and then get the necessary files from ftp server to the local folder.
  4. Second set of commands execute the Data Loader CLI jar and loads step3 retrieved file into Salesforce.
  5. To automate the execution of the batch, we can schedule the bat file execution using scheduled task feature of Windows operating system.

II – Java Web Service

  1. Write a Java FTP client, expose it as a Web Service
  2. Consume above WS into your Salesforce Org using Apex “Browse WSDL” functionality

III – Http Request

  1. Create a Http Request to the FTP server
  2. Handle the response using either of HttpRequest and HttpResponse Apex Class
  3. Ps: The problem that you can face is the size of the files. Please remember that HTTP Request size are currently limited to 100Kb of data, so larger exports would fail unless a mechanism was created to utilize multi-part transmissions.