31 lines
1.0 KiB
Java
31 lines
1.0 KiB
Java
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());
|
||
}
|
||
}
|