From f7b644ecaec2f3f186fbedbb350320214afec297 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9B=B9=E7=A3=8A?= <45566618@qq.com> Date: Tue, 21 May 2024 09:31:50 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B5=84=E6=BA=90=E5=BA=93=EF=BC=9ASFTP?= =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E4=B8=8B=E8=BD=BD=E5=88=A0=E9=99=A4=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E4=BC=98=E5=8C=96=EF=BC=8C=E6=A0=B9=E6=8D=AEyml?= =?UTF-8?q?=E4=B8=AD=E9=85=8D=E7=BD=AEuploadType=E6=9D=A5=E5=AE=9E?= =?UTF-8?q?=E7=8E=B0=E6=9C=AC=E5=9C=B0=E8=BF=98=E6=98=AFsftp=E4=B8=8A?= =?UTF-8?q?=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/org/jeecg/common/util/SFTPUtil.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/SFTPUtil.java b/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/SFTPUtil.java index 6c90132c..a001f3bc 100644 --- a/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/SFTPUtil.java +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/SFTPUtil.java @@ -166,7 +166,7 @@ public class SFTPUtil { try{ sftp = connect(sftpConfig); try { - directory = getDirectory(sftpConfig.getUploadpath(), directory); +// directory = getDirectory(sftpConfig.getUploadpath(), directory); sftp.cd(directory); } catch (SftpException e1) { try { @@ -386,14 +386,13 @@ public class SFTPUtil { map.put("msg", "ftp创建" + directory + "文件路径失败"); } } - Session session = null; Channel channel = null; try { String oldfullpath = sftpConfig.getFullpath().concat(oldpath); String newpath = directory.concat(newname); String newfullpath = sftpConfig.getFullpath().concat(newpath); String moveCommand = "mv " + oldfullpath + " " + newfullpath; // 移动文件的命令 - session = sftp.getSession(); + Session session = sftp.getSession(); channel = session.openChannel("exec"); ((ChannelExec) channel).setCommand(moveCommand); channel.setInputStream(null);