static void downloadAllFiles(String fileType) {
    try {
      java.util.Vector fileList = sftpChannel.ls(".");
      if (fileList != null) {
        for (int ii = 0; ii < fileList.size(); ii++) {
          Object obj = fileList.elementAt(ii);
          LsEntry lsentry = (com.jcraft.jsch.ChannelSftp.LsEntry) obj;

          if (obj instanceof com.jcraft.jsch.ChannelSftp.LsEntry) {
            String fileName = ((com.jcraft.jsch.ChannelSftp.LsEntry) obj).getFilename();
            if (fileType.equals(".*")) {
              if (!(lsentry.getAttrs().isDir())) {
                boolean valid = checkFileName(fileName);
                if (valid) {
                  totalFileCount++;
                  downloadFileByName(fileName);
                }
              }
            } else if (fileName.toLowerCase().endsWith(fileType)) {
              boolean valid = checkFileName(fileName);
              if (valid) {
                totalFileCount++;
                downloadFileByName(fileName);
              }
            }
          }
        }
      }
    } catch (Exception e) {
      System.out.println("Exception in downloadAllFiles(): " + e.toString());
      errorMessage += "Exception in downloadAllFiles(): " + e.toString() + "\n";
    }
  }
  private static boolean isDirecotryExist(String processedDirectory) {
    try {
      java.util.Vector fileList = sftpChannel.ls(".");
      if (fileList != null) {
        for (int ii = 0; ii < fileList.size(); ii++) {
          Object obj = fileList.elementAt(ii);
          LsEntry lsentry = (com.jcraft.jsch.ChannelSftp.LsEntry) obj;

          if (obj instanceof com.jcraft.jsch.ChannelSftp.LsEntry) {
            String fileName = ((com.jcraft.jsch.ChannelSftp.LsEntry) obj).getFilename();
            if (fileName.equals(processedDirectory)) {
              return true;
            }
          }
        }
      }
    } catch (Exception e) {
      System.out.println("Exception in isDirecotryExist(): " + e.toString());
      errorMessage += "Exception in isDirecotryExist(): " + e.toString() + "\n";
    }
    return false;
  }