Hi all, Im currently working on a FTP program that downloads all files in a directory. Currently, I am able to list all the files in that directory, but I am stuck as on how to download all of them automatically. Would need some help in this. Thank you.

import java.io.*;
import java.net.URL;
import java.net.URLConnection;
import java.net.*;

public class DownLoad {
	
	public static void main(String args[]) {
		try {
			java.net.URL url = new java.net.URL("ftp://ftp.wwpdb.org//pub//pdb//data//structures//all//pdb//");
			java.io.InputStream in = url.openStream();
			
			int count = in.available();
			byte content[] = new byte[count];
			in.read(content, 0, count);
				String contentAsString = new String(content, 0, count);
				System.out.println(contentAsString);
				
									} catch (Exception e) {
							e.printStackTrace();
											}
										   }
						}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.