public boolean isExistDir(String path,ChannelSftp sftp){
boolean isExist=false;
try {
SftpATTRS sftpATTRS = sftp.lstat(path);
isExist = true;
return sftpATTRS.isDir();
} catch (Exception e) {
if (e.getMessage().toLowerCase().equals("no such file")) {
isExist = false;
}
}
return isExist;
}
java sftp判断目录是否存在
最新推荐文章于 2024-08-24 04:28:45 发布