[ Web Proxy ]
URL:
Viewing: https://raw.githubusercontent.com/cherkavi/java-code-example/master/FtpStore/src/StoreToFtp.java [Back]  [Original]

import it.sauronsoftware.ftp4j.FTPClient;
import it.sauronsoftware.ftp4j.FTPFile;


import java.io.File;
import java.io.IOException;

import org.jibble.simpleftp.SimpleFTP;


public class StoreToFtp {
	public static void main(String[] args){
		System.out.println("begin");
		// System.out.println("Upload: "+uploadToFtp("D:\\headphones.txt ", "91.211.119.222", 21, "ftp-tomcat", "llooggSSTOM"));
		/*System.out.println("Upload: "+uploadToFtp4J("D:\\headphones.txt", 
													"91.211.119.222", 
													21, 
													"ftp-tomcat", 
													"llooggSSTOM"));*/
		printDirectory("192.168.0.2",21, "technik", "technik","shops");
		System.out.println("-end-");
	}
	
	/*
URL url = 
    new URL("ftp://username:password@ftp.whatever.com/file.zip;type=i");
URLConnection con = url.openConnection();
BufferedInputStream in = 
    new BufferedInputStream(con.getInputStream());
FileOutputStream out = 
    new FileOutputStream("C:\\file.zip");

int i = 0;
byte[] bytesIn = new byte[1024];
while ((i = in.read(bytesIn)) >= 0) {
	out.write(bytesIn, 0, i);
}
out.close();
in.close();	 */
	
	private static void printDirectory(String ftpServer, int port, String userName, String password, String directoryOnServer){
		try{
			FTPClient client=new FTPClient();
			client.connect(ftpServer, port);
			client.login(userName, password);
			client.changeDirectory(directoryOnServer);
			FTPFile[] fileList=client.list();
			for(int counter=0;counter

Web Proxy Viewer  |  New URL  |  Original Page