Esempio n. 1
0
  static void downloadFileByName(String filename) {
    try {
      System.out.println("Downloading file : " + filename);
      int mode = ChannelSftp.OVERWRITE;
      sftpChannel.get(filename, localDirectory, null, mode);
      downloadedFileCount++;
      System.out.println("Download Completed.");

      // file moving to processed folder
      moveFileToProcessedFolder(filename);
    } catch (SftpException e) {
      System.out.println("Exception in downloadFileByName(" + filename + "): " + e.toString());
      errorMessage += "Exception in downloadFileByName(" + filename + "): " + e.toString() + "\n";
    } catch (Exception e) {
      System.out.println("Exception in downloadFileByName(" + filename + "): " + e.toString());
      errorMessage += "Exception in downloadFileByName(" + filename + "): " + e.toString() + "\n";
    }
  }