79810693

Date: 2025-11-05 23:17:43
Score: 1
Natty:
Report link

you are geniuses. Thank you very much!
I solved my problem!
This is my test method:

public static boolean DelDirectory(ChannelSftp chanSftp, String sPath) throws SftpException {
    boolean bEnd = true;
    Vector<ChannelSftp.LsEntry> files = chanSftp.ls(sPath);
    for (ChannelSftp.LsEntry entry : files) {
      if (entry.getAttrs().isDir()) {
        if (!entry.getFilename().equals(".") && !entry.getFilename().equals("..")) {
          bEnd = false;
          bEnd = DelDirectory(chanSftp, sPath + "/" + entry.getFilename());
          if (bEnd) {
            chanSftp.rmdir(sPath + "/" + entry.getFilename());
          }
        }
      } else {
        chanSftp.rm(sPath + "/" + entry.getFilename());
      }
    }
    return bEnd;
  }

I would just like to ask you for a clarification.
As development environment I use NetBeans and it tells me that the Vector is an obsolete collection.
What can I replace it with?

Reasons:
  • Blacklisted phrase (0.5): Thank you
  • Whitelisted phrase (-2): I solved
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Ends in question mark (2):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: ZioCrick