0

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();
											}
										   }
						}
2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by NormR1
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.