SFTP上传原文件路径优化
This commit is contained in:
parent
601c9eab7b
commit
9876f909c5
|
@ -390,6 +390,9 @@ public class SFTPUtil {
|
||||||
}
|
}
|
||||||
Channel channel = null;
|
Channel channel = null;
|
||||||
try {
|
try {
|
||||||
|
if(!oldpath.startsWith("/")){
|
||||||
|
oldpath = "/"+oldpath;
|
||||||
|
}
|
||||||
String oldfullpath = sftpConfig.getFullpath().concat(oldpath);
|
String oldfullpath = sftpConfig.getFullpath().concat(oldpath);
|
||||||
String newpath = directory.concat(newname);
|
String newpath = directory.concat(newname);
|
||||||
String newfullpath = sftpConfig.getFullpath().concat(newpath);
|
String newfullpath = sftpConfig.getFullpath().concat(newpath);
|
||||||
|
@ -463,6 +466,9 @@ public class SFTPUtil {
|
||||||
StringBuffer sb = new StringBuffer();
|
StringBuffer sb = new StringBuffer();
|
||||||
for(int item=0;item<list.size();item++){
|
for(int item=0;item<list.size();item++){
|
||||||
String oldpath = list.get(item)[0];
|
String oldpath = list.get(item)[0];
|
||||||
|
if(!oldpath.startsWith("/")){
|
||||||
|
oldpath = "/"+oldpath;
|
||||||
|
}
|
||||||
String oldfullpath = sftpConfig.getFullpath().concat(oldpath);
|
String oldfullpath = sftpConfig.getFullpath().concat(oldpath);
|
||||||
String newname = list.get(item)[1];
|
String newname = list.get(item)[1];
|
||||||
String newpath = directory.concat(newname);
|
String newpath = directory.concat(newname);
|
||||||
|
|
Loading…
Reference in New Issue