FTP - microfox-framework/MicroFox GitHub Wiki
FTP (File Transfer Protocol) is a standard network protocol used to transfer files between a client and a server over a TCP/IP network. MicroFox provides built-in support for FTP operations such as uploading, downloading, listing, and deleting files, with both single and batch processing capabilities.
The integration is designed to be simple and lightweight, allowing developers to interact with remote FTP servers using intuitive utility methods
Before performing any FTP operation, you need to configure your connection settings using MicroFoxFtpConfig
. This typically includes:
MicroFoxFtpConfig config = new MicroFoxFtpConfig();
config.setHost("ftp.example.com");
config.setPort(21);
config.setUsername("ftpuser");
config.setPassword("ftppass");
ftpDownload(config, "/remote/path/file.txt", Paths.get("/local/download/dir"));
Downloads a single file from the remote server.
List<String> files = List.of("/remote/file1.txt", "/remote/file2.txt");
ftpBatchDownload(config, files, Paths.get("/local/download/dir"));
Downloads multiple files from the remote server.
ftpUpload(config, "/remote/path/file.txt", new File("/local/file.txt"));
Uploads a local file to the remote server.
List<File> files = List.of(
new File("/local/file1.txt"),
new File("/local/file2.txt")
);
ftpBatchUpload(config, "/remote/upload/dir", files);
Uploads multiple files to the specified remote directory.
ftpDelete(config, "/remote/path/file.txt");
Deletes a file from the remote server.
ftpList(config, "/remote/dir", files -> {
for (FTPFile file : files) {
System.out.println(file.getName() + " - " + file.getSize());
}
});
Retrieves and processes a list of files from the specified remote directory.
- Simple, readable API for common FTP operations
- Batch upload/download support for large-scale transfers
- Useful for integrations, backups, or file synchronization tasks
- Easily extendable and customizable via the
MicroFoxFtpConfig
class