Advertisement
Guest User

Untitled

a guest
Feb 14th, 2016
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. try {
  2. ftpClient.setFileType(FTP.BINARY_FILE_TYPE);
  3. success = ftpClient.changeWorkingDirectory(PATH + preset + "/" + file_to_download + offset);
  4. System.out.println("Download Path:-" + PATH + preset + "/" + file_to_download + offset);
  5. if (!success) {
  6. System.out.println("Could not changed the directory to RIBS");
  7. return;
  8. } else {
  9. System.out.println("Directory changed to RIBS");
  10. }
  11. FTPFile[] files = ftpClient.listFiles();
  12. for (FTPFile file : files) {
  13. if (file.getName().contains(".zip")) {
  14. dfile = file.getName();
  15. }
  16.  
  17. }
  18. DirectoryChooser dirChooser = new DirectoryChooser();
  19. File chosenDir = dirChooser.showDialog(tableView.getScene().getWindow());
  20. System.out.println(chosenDir.getAbsolutePath());
  21. OutputStream output;
  22. output = new FileOutputStream(chosenDir.getAbsolutePath() + "/" + dfile);
  23. int timeOut = 500;
  24. ftpClient.setConnectTimeout(timeOut);
  25. if (ftpClient.retrieveFile(dfile, output) == true) {
  26. downloadButton.setDisable(true);
  27. }
  28. output.close();
  29.  
  30. } catch (IOException e) {
  31. // TODO Auto-generated catch block
  32. e.printStackTrace();
  33. }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement