Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Maybe it will be useful to somebody with same problem. I made program by this method:</p> <pre><code>package javaapplication2; import java.io.BufferedInputStream; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import org.apache.commons.net.ftp.*; public class DLFile { public static void saveZIP() throws Exception { FTPClient client = new FTPClient(); FileOutputStream new_file = null; String server = "server"; String user = "user"; String pass = "pass"; String name = ""; String downloadFolder = "download_folder"; Boolean exists = null; int i=0; int j=0; client.connect(server); client.login(user,pass); client.changeWorkingDirectory("/rtr/"); //read ftp content String[] names = client.listNames(); File folder = new File(downloadFolder); String[] filename = folder.list(); for (;i&lt;names.length;i++) { name = names[i]; exists=false; if (name.contains(".zip")) { if (filename.length == 0) { new_file = new FileOutputStream(downloadFolder + name); client.retrieveFile(name, new_file); j++; exists=true; } else { //CHECK IF FILE EXISTS if (!new File(downloadFolder + name).exists()) { new_file = new FileOutputStream(downloadFolder + name); client.retrieveFile(name, new_file); j++; exists=true; } }//else }//if contains .zip }//for if (exists = true) { System.out.println("Downloading ZIP files: Downloaded " + j + " files"); } else System.out.println("Downloading ZIP files: Files already exist."); client.logout(); } } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload