evoToK3Cloud/ruoyi-common/src/test/java/com/ruoyi/common/utils/FtpDownloadTest.java
2026-04-12 10:11:15 +08:00

31 lines
1.0 KiB
Java
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package com.ruoyi.common.utils;
import com.ruoyi.common.core.domain.R;
import org.junit.Test;
public class FtpDownloadTest {
@Test
public void testDownload() {
String host = "192.168.5.18";
int port = 21; // 使用21端口测试下载根据你之前代F码的默认行为一般下载用21
String username = "admin";
String password = "hbyt2025";
// 你的实际测试路径
String remoteDir = "/2026/QB-26-072-XCL"; // 你想测试下载的 FTP 目录
String localDir = "D:\\file\\test_download"; // 本地存放目录
System.out.println("开始测试下载 FTP 目录: " + remoteDir);
// 调用 FtpUtil 下载文件
R<String> result = FtpUtil.downloadFtpDirectoryFiles(
host, username, password, port, remoteDir, localDir, null
);
System.out.println("下载结果 Code: " + result.getCode());
System.out.println("下载结果 Msg: " + result.getMsg());
System.out.println("下载结果 Data: " + result.getData());
}
}