Commit 6d1f1f28 by s_guodong

修改sftpConnection2的bug

parent 75256457
......@@ -173,6 +173,9 @@ public class SftpConnection2 extends AbsConnection {
String filename = null;
String localFilePath = null;
try {
if (!new File(localPath).exists()) {
new File(localPath).mkdirs();
}
Matcher matcher = null;
Vector<LsEntry> vector = sftp.ls(remotePath);
if (vector.size() == 1) {
......@@ -181,13 +184,17 @@ public class SftpConnection2 extends AbsConnection {
sftp.cd(remotePath);
for (LsEntry entry : vector) {
filename = entry.getFilename();
if (entry.getLongname().startsWith("d")) {
continue;
}
if (StringUtil.isEmpty(filenameRegex)) {
localFilePath = localPath + File.separator + filename;
localFilePath = localPath + filename;
File file = new File(localFilePath);
if (file.exists()) {
file.delete();
}
file.createNewFile();
output = new FileOutputStream(file);
sftp.get(filename, output);
if (deleteFlag) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment