FTP Utils | MuleSoft Documentation
# FTP Utils
Anypoint Code Builder 
Anypoint Studio 
To test a piece of code that connects with an FTP server, install an FTP server in your local environment to run the tests. You can also use a dedicated external FTP server for testing, but your Maven project can’t be portable. A third party must install the testing FTP server to compile your project.
To test the FTP connections, you can implement an FTP server in your local environment with MUnit.
## Install the MUnit FTP Server Module
To install the MUnit FTP server module:
  1. Look for the **MUnit Utils FTP Server** module.
  2. Add the module to your project:
```
<!-- Ftp Server Dependency -->
<dependency>
  <groupId>com.mulesoft.munit.utils</groupId>
  <artifactId>munit-ftpserver-module</artifactId>
  <version>LATEST_VERSION</version> **(1)**
  <classifier>mule-plugin</classifier>
  <scope>test</scope>
</dependency>
```

Check the MuleSoft Nexus repository to get the **LATEST_VERSION**.  
---  


The MUnit FTP server artifact in your POM file must have the `test` scope.
The **MUnit FTP Server** module is located at MuleSoft Nexus repository. The **MUnit FTP Server** module version 3 and later is compatible with Java 17. Previous versions of this module available at Anypoint Exchange are deprecated.   
---  
## Attributes Reference
The FTP server module takes the following parameters:
Attribute Name | Description  
---|---  
Defines the configuration name of the FTP server. This value must be unique.  
Defines the port on which the FTP server listens.  
(Boolean) Sets anonymous access to the FTP server. If you set `anonymous` to `true`, don’t set a password to access the FTP server when using the `anonymous` username. The default value is `true`.  
(Boolean) Defines the FTP protocol. If you set the `secure` parameter to `true`, the server behaves as an SFTP server and connections must be authenticated. If you set the `secure` parameter to `false`, the server behaves as an FTP server and allows either authenticated or anonymous connections. The default value is `false`.  
Defines the user’s home directory. The default value is the filesystem root. You can define the FTP user home directory by using the `~` character to represent the home directory on the file system.  
## MUnit FTP Server Processors
The FTP Utility has two processors to interact with your FTP server: 

contains-files
    
The `contains-files` processor validates the existence of a file in the FTP server. If there is no file present, the processor fails causing the test to fail.
```
<ftpserver:contains-files config-ref="MUnit_FTP_Server_Config" path="/" file="example.txt"/>
```

Attribute Name | Description  
---|---  
`config-ref` | Defines the FTP server configuration.  
Defines in which folder to search based on the user home directory defined.  
Defines the name of the file to look for. 

remove
      
The `remove` processor provides an operation that instructs the FTP server to remove a file from storage.
```
<ftpserver:remove config-ref="MUnit_FTP_Server_Config" path="example.txt"/>
```

Attribute Name | Description  
---|---  
`config-ref` | Defines the FTP server configuration.  
Defines the full path of the file to remove.  
This feature is useful when creating the same file name several times. You can configure it in `after-test` to ensure that no name collisions cause the test to fail.
## See Also
  * Configuring FTP Server Utility in an MUnit Test