Hi all,
currently i can download only one file from the server, how do i download all the remaining files i want automatically using Java codes??
import java.io.*;
import java.net.URL;
import java.net.URLConnection;
import java.io.FileOutputStream;
public class ftp {
public static void main(String[] args) {
try{
URL url = new URL("ftp://ftp.wwpdb.org//pub//pdb//data//structures//all//pdb//pdb100d.ent.gz;type=d");
URLConnection con = url.openConnection();
BufferedInputStream in = new BufferedInputStream(con.getInputStream());
FileOutputStream out = new FileOutputStream("C:\\Users\\Royston\\Documents\\FTP downloads\\pdb100d.ent.gz");
int i = 0;
byte[] bytesIn = new byte[1024];
while ((i = in.read(bytesIn)) >= 0)
{
out.write(bytesIn, 0, i);
}
out.close();
in.close();
} catch(Exception e)
{
e.printStackTrace();
}
}
}
download
Related question : How To Download From Pdb (Ftp)Website Using Java Codes?
It seems to me from your questions so far, that what you need is a good introductory guide to Java programming, rather than advice from a bioinformatics website. Also, as mentioned already, people will be more inclined to answer future questions if you give them credit for previous answers by selecting the best answer.