/Users/lyon/j4p/src/net/ftp/Download.java

1    package net.ftp; 
2    /** 
3     * This class uses ftp protocol to 
4     * download files from an ftp server. 
5     * Ftp is not secure, and so it is typiclaly blocked. 
6     * A better way might be to use SCP (secure copy). 
7     */ 
8     
9    public class Download { 
10    
11   // Homework, write listFileToConsole... 
12   // Homework, write lsToConsole... 
13   // Homework, extra credit?, write upload file to host. 
14   /* 
15       String  fileName = "readme"; 
16       String  directory = "/pub/ipij/"; 
17       String  hostName = "vinny.bridgeport.edu"; 
18       String  userName = "anonymous"; 
19       String  password = "lyon@docjava.com"; 
20   */ 
21     public static void main(String[] args) { 
22       // sandbox! 
23       // net.ftp://ftpin:@vinny.bridgeport.edu/ 
24       String directory = "/incoming/"; 
25       String hostName = "vinny.bridgeport.edu"; 
26       String userName = "ftpin"; 
27       String password = "ftpin"; 
28       String s = FTPCommands.getFileList( 
29           directory, 
30           hostName, 
31           userName, 
32           password); 
33       System.out.println(s); 
34     } 
35    
36   }